//
//  ViewController.m
//  测试SDK2
//
//  Created by HW1-MM02 on 2016/12/22.
//  Copyright © 2016年 HW1-MM02. All rights reserved.
//

#import "ViewController.h"
#import "MApi.h"
#import "NSObject+Ext.h"

//#ifdef DEBUG
//
//#define NSLog(FORMAT, ...) fprintf(stderr, "%s:%zd\t%s\n", [[[NSString stringWithUTF8String: __FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat: FORMAT, ## __VA_ARGS__] UTF8String]);
//
//#else
//
//#define NSLog(FORMAT, ...) nil
//
//#endif

@interface ViewController ()
{
    NSDictionary * data;
    NSMutableArray *_arr11;
}
@end

@implementation ViewController

//-(void)changeIPList{
//
//    NSArray *serverList =  [MApi serverListWithMarket:MApiMarketSH permission:MApiSourceLevel1];
//    NSLog(@"IP地址列表%@",serverList);
//
//    NSArray *List = [NSArray arrayWithObjects:@"http://114.80.155.134:22016",@"http://114.80.155.139:22016",nil];
//    [MApi resetServerList:List withMarket:MApiMarketBJ permission:MApiSourceLevel1];
//}

- (void)TCP{
    self.codes = @"600000.sh";
    //千档
//    [MApi subscribeCode:self.codes type:MApiTcpSubscribeTypeThousands];
    /* 全席队列
        订阅代码  股票代码 $ 档位价格
        其中档位价格 为千档行情返回的原始价格
     */
//    [MApi subscribeCode:self.codes type:MApiTcpSubscribeTypeQX];
//    逐笔还原
//    [MApi subscribeCode:self.codes type:MApiTcpSubscribeTypeL2PlusTickDetail];
    //逐笔委托
//    [MApi subscribeCode:self.codes type:MApiTcpSubscribeTypeTickEntrust];

    //监听
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(tcpDidReceivedData:)
                                                 name:MApiTcpDidReceivedDataNotification
                                               object:nil];
}
- (void)viewDidLoad {
    _arr11 = [NSMutableArray new];
    [super viewDidLoad];
    
    _textInPut1 = [[UITextField alloc] initWithFrame:CGRectMake(10, 100, [UIScreen mainScreen].bounds.size.width-20, 30)];
    _textInPut1.borderStyle = UITextBorderStyleLine;
    _textInPut1.placeholder = @"请输入股票代码";
    _textInPut1.clearButtonMode = UITextFieldViewModeWhileEditing;
    [self.view addSubview:_textInPut1];

    UILabel * label=[[UILabel alloc] initWithFrame:CGRectMake(12, 20, 200, 80)];
    label.text=@"这是测试SDK的应用";
    [self.view addSubview:label];
    
    UIButton * btnL1=[UIButton buttonWithType:UIButtonTypeRoundedRect];
    btnL1.frame=CGRectMake(212, 45, 40, 30);
    [btnL1 setTitle:@"L1" forState:UIControlStateNormal];
    [btnL1 addTarget:self action:@selector(level1) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btnL1];
    
    UIButton * btnL2=[UIButton buttonWithType:UIButtonTypeRoundedRect];
    btnL2.frame=CGRectMake(252, 45, 40, 30);
    [btnL2 setTitle:@"L2" forState:UIControlStateNormal];
    [btnL2 addTarget:self action:@selector(level2) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btnL2];
    
    UIButton * btn=[UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn.frame=CGRectMake(12, 130, 80, 30);
    [btn setTitle:@"获取委托" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(touch) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    
    UIButton * btn1=[UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn1.frame=CGRectMake(([UIScreen mainScreen].bounds.size.width-24)/3, 130, 80, 30);
    [btn1 setTitle:@"获取还原" forState:UIControlStateNormal];
    [btn1 addTarget:self action:@selector(touch1) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn1];
    
    UIButton * btn2=[UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn2.frame=CGRectMake(([UIScreen mainScreen].bounds.size.width-24)/3*2, 130, 80, 30);
    [btn2 setTitle:@"分时明细" forState:UIControlStateNormal];
    [btn2 addTarget:self action:@selector(touch2) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn2];
    
    UIButton * btn3=[UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn3.frame=CGRectMake(12, 160, 80, 30);
    [btn3 setTitle:@"分比明细" forState:UIControlStateNormal];
    [btn3 addTarget:self action:@selector(touch3) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn3];
    
    UIButton * btn4=[UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn4.frame=CGRectMake(([UIScreen mainScreen].bounds.size.width-24)/3, 160, 80, 30);
    [btn4 setTitle:@"逐笔明细" forState:UIControlStateNormal];
    [btn4 addTarget:self action:@selector(touch4) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn4];
    
    [self registerServer];
//    UIButton * btn1=[UIButton buttonWithType:UIButtonTypeRoundedRect];
//    btn1.frame=CGRectMake(12, 200, 100, 40);
//    [btn1 setTitle:@"点击重新认证" forState:UIControlStateNormal];
//    [btn1 addTarget:self action:@selector(registerServer1) forControlEvents:UIControlEventTouchUpInside];
//    [self.view addSubview:btn1];
}

//-(void)changeIPList{
//
//    NSArray *serverList =  [MApi serverListWithMarket:MApiMarketSH permission:MApiSourceLevel1];
//    NSLog(@"IP地址列表%@",serverList);
//
//    NSArray *List = [NSArray arrayWithObjects:@"http://114.80.155.134:22016",@"http://114.80.155.139:22016",nil];
//    [MApi resetServerList:List withMarket:MApiMarketBJ permission:MApiSourceLevel1];
//

- (void)level1{
    [MApi setSourcePermissions:@{
        MApiMarketSH:@(MApiSourceLevel1),
        MApiMarketSZ:@(MApiSourceLevel1),
        MApiMarketBJ:@(MApiSourceLevel1),
        MApiMarketHK:@(MApiSourceHK10),
        MApiMarketCFF:@(MApiSourceCFF1),
        MApiMarketDCE:@(MApiSourceDCE1),
        MApiMarketCZCE:@(MApiSourceCZCE1),
        MApiMarketSHFE:@(MApiSourceSHFE1),
        MApiMarketINE:@(MApiSourceINE1)
        }];
    NSLog(@"当前权限L1 !");
}
- (void)level2{
    [MApi setSourcePermissions:@{
        MApiMarketSH:@(MApiSourceLevel2),
        MApiMarketSZ:@(MApiSourceLevel2),
        MApiMarketBJ:@(MApiSourceLevel2),
        MApiMarketHK:@(MApiSourceHK10),
        MApiMarketCFF:@(MApiSourceCFF1),
        MApiMarketDCE:@(MApiSourceDCE1),
        MApiMarketCZCE:@(MApiSourceCZCE1),
        MApiMarketSHFE:@(MApiSourceSHFE1),
        MApiMarketINE:@(MApiSourceINE1)
        }];
    NSLog(@"当前权限L2 !");
}
-(void)touch{
    [_arr11 removeAllObjects];
    [self zhubiweituo: @"0,100,-1"];

}
-(void)touch1{
    [_arr11 removeAllObjects];
    [self zhubihuanyuan: @"0,100,-1"];

}
-(void)touch2{
    [_arr11 removeAllObjects];
    [self fenshimingxi: @"0,100,-1"];

}
-(void)touch3{
    [_arr11 removeAllObjects];
    [self fenbimingxi: @"0,100,-1"];

}
-(void)touch4{
    [_arr11 removeAllObjects];
    [self zhubimingxi: @"0,100,-1"];

}
-(NSString*)HQKZ{
    MSnapQuoteRequest *request = [[MSnapQuoteRequest alloc] init];
    request.code = _textInPut1.text; //填入股票代码
        //发送请求
    __block NSString *_subtype;
    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
        if (resp.status == MResponseStatusSuccess) {
            //应答无误，处理数据更新画面
            MSnapQuoteResponse *response = (MSnapQuoteResponse *)resp;
            MStockItem *item = response.stockItem;
            _subtype = item.subtype;
        }else {
                        //应答错误，显示错误信息
                        NSLog(@"回传代码：%ld",(long)resp.status);
                        //NSLog(@"错误站点信息：%@",request.ip);
                        NSLog(@"行情快照请求错误，错误信息是：%@",resp.message);
                    }
                }];
    return _subtype;
}
-(void)zhubiweituo:(NSString*)param{
    
//  练习:逐笔委托
    ML2TickEntrustRequest *request = [[ML2TickEntrustRequest alloc] init];
    request.code = _textInPut1.text;
    request.subtype = [self HQKZ];
//        request.index = @"0";
//        request.pageSize = 200;
//        request.param = @"2.137679E7,20,1";
    request.param = param;
    request.type = MTimeTickRequestTypeRecent;
    __block NSInteger count;
    __block NSString *endI;
    //发送请求
    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
        if (resp.status == MResponseStatusSuccess) {
            //应答无误，处理数据更新画面
            ML2TickEntrustResponse *response = (ML2TickEntrustResponse *)resp;
            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
            NSLog(@"%@,%@",response.startIndex,response.endIndex);
            NSArray *item = response.items;
            count = item.count;
            endI = response.endIndex;
            NSLog(@"shuliang: %lu",(unsigned long)item.count);
            for (int i=0; i<item.count; i++) {
                MTickEntrustItem *items = item[i];
                [_arr11 addObject: [NSString stringWithFormat:@"%@,%@,%@,%@,%@",items.sn,items.price,items.volume,items.bs,items.time]];
            }
            if (count==100){
                [self zhubiweituo: [NSString stringWithFormat:@"%@,100,1",response.endIndex]];
            }else{
                NSLog(@"逐笔委托数据如下，共有%lu条数据",(unsigned long)_arr11.count);
                for (int i=0;i<_arr11.count;i++){
                    NSLog(@"result: %@",_arr11[i]);
                }

            }

        } else {
            //应答错误，显示错误信息
            NSLog(@"逐笔委托请求错误，错误信息是：%@",resp.message);
        }
    }];

}

-(void)zhubihuanyuan:(NSString*)param{
    
//  练习:逐笔还原
    ML2PlusTimeTickDetailRequest *request = [[ML2PlusTimeTickDetailRequest alloc] init];
    request.code = _textInPut1.text;
    request.subtype = [self HQKZ];
    request.param = param;
    request.type = MTimeTickRequestTypeRecent;
    __block NSInteger count;
    __block NSString *endI;
    //发送请求
    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
        if (resp.status == MResponseStatusSuccess) {
            //应答无误，处理数据更新画面
            ML2PlusTimeTickDetailResponse *response = (ML2PlusTimeTickDetailResponse *)resp;
            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
            NSLog(@"%@,%@",response.startIndex,response.endIndex);
            NSArray *item = response.items;
            count = item.count;
            endI = response.endIndex;
            NSLog(@"shuliang: %lu",(unsigned long)item.count);
            for (int i=0; i<item.count; i++) {
                MTimeTickDetailItem *items = item[i];
                [_arr11 addObject: [NSString stringWithFormat:@"%@,%@,%@,%@,%@",items.bn,items.on,items.time,items.bq,items.oq]];
            }
            if (count==100){
                [self zhubihuanyuan: [NSString stringWithFormat:@"%@,100,1",response.endIndex]];
            }else{
                NSLog(@"逐笔还原数据如下，共有%lu条数据",(unsigned long)_arr11.count);
                for (int i=0;i<_arr11.count;i++){
                    NSLog(@"result: %@",_arr11[i]);
                }

            }

        } else {
            //应答错误，显示错误信息
            NSLog(@"逐笔还原请求错误，错误信息是：%@",resp.message);
        }
    }];
    
}
-(void)fenshimingxi:(NSString*)param{
    
//  练习:分时明细
    MTimeTickRequest *request = [[MTimeTickRequest alloc] init];
    request.code = _textInPut1.text;
    request.subtype =[self HQKZ];
    request.param = param;
    request.type = MTimeTickRequestTypeRecent;
    __block NSInteger count;
    __block NSString *endI;
    //发送请求
    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
        if (resp.status == MResponseStatusSuccess) {
            //应答无误，处理数据更新画面
            MTimeTickResponse *response = (MTimeTickResponse *)resp;
            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
            NSLog(@"%@,%@",response.startIndex,response.endIndex);
            NSArray *item = response.items;
            count = item.count;
            endI = response.endIndex;
            NSLog(@"shuliang: %lu",(unsigned long)item.count);
            for (int i=0; i<item.count; i++) {
                MTimeTickItem *items = item[i];
                NSString *ty;
                if (items.type == 1){
                    ty = @"B";
                }else if (items.type == 2){
                    ty = @"S";
                }else{
                    ty = @"N";
                }
                [_arr11 addObject: [NSString stringWithFormat:@"交易时间:*%@*,成交价格:*%@*,交易量:*%@*,买卖方向:*%@*",items.time8,items.tradePrice,items.tradeVolume,ty]];
            }
            if (count==100){
//                NSLog(@"````%@",[NSString stringWithFormat:@"%@,100,1",response.endIndex]);
                [self fenshimingxi: [NSString stringWithFormat:@"%@,100,1",response.endIndex]];
            }else{
                NSLog(@"分时明细数据如下，共有%lu条数据",(unsigned long)_arr11.count);
                for (int i=0;i<_arr11.count;i++){
                    NSLog(@"result: %@",_arr11[i]);
                }

            }

        } else {
            //应答错误，显示错误信息
            NSLog(@"分时明细请求错误，错误信息是：%@",resp.message);
        }
    }];
}
-(void)fenbimingxi:(NSString*)param{
//  练习:分笔明细
    ML2TimeTickRequest *request = [[ML2TimeTickRequest alloc] init];
    request.code = _textInPut1.text;
    request.subtype =[self HQKZ];
    request.param = param;
    request.type = MTimeTickRequestTypeRecent;
    __block NSInteger count;
    __block NSString *endI;
    //发送请求
    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
        if (resp.status == MResponseStatusSuccess) {
            //应答无误，处理数据更新画面
            ML2TimeTickResponse *response = (ML2TimeTickResponse *)resp;
            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
            NSLog(@"%@,%@",response.startIndex,response.endIndex);
            NSArray *item = response.items;
            count = item.count;
            endI = response.endIndex;
            NSLog(@"shuliang: %lu",(unsigned long)item.count);
            for (int i=0; i<item.count; i++) {
                MTimeTickItem *items = item[i];
                NSString *ty;
                if (items.type == 1){
                    ty = @"B";
                }else if (items.type == 2){
                    ty = @"S";
                }else{
                    ty = @"N";
                }
                [_arr11 addObject: [NSString stringWithFormat:@"交易时间:*%@*,成交价格:*%@*,交易量:*%@*,买卖方向:*%@*",items.time8,items.tradePrice,items.tradeVolume,ty]];
            }
            if (count==100){
//                NSLog(@"````%@",[NSString stringWithFormat:@"%@,100,1",response.endIndex]);
                [self fenbimingxi: [NSString stringWithFormat:@"%@,100,1",response.endIndex]];
            }else{
                NSLog(@"分笔明细数据如下，共有%lu条数据",(unsigned long)_arr11.count);
                for (int i=0;i<_arr11.count;i++){
                    NSLog(@"result: %@",_arr11[i]);
                }
            }
        } else {
            //应答错误，显示错误信息
            NSLog(@"分笔明细请求错误，错误信息是：%@",resp.message);
        }
    }];
}
-(void)zhubimingxi:(NSString*)param{
//  练习:逐笔明细
    ML2TimeTickDetailRequest *request = [[ML2TimeTickDetailRequest alloc] init];
    request.code = _textInPut1.text;
    request.subtype =[self HQKZ];
    request.param = param;
    request.type = MTimeTickRequestTypeRecent;
    __block NSInteger count;
    __block NSString *endI;
    //发送请求
    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
        if (resp.status == MResponseStatusSuccess) {
            //应答无误，处理数据更新画面
            ML2TimeTickDetailResponse *response = (ML2TimeTickDetailResponse *)resp;
            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
            NSLog(@"%@,%@",response.startIndex,response.endIndex);
            NSArray *item = response.items;
            count = item.count;
            endI = response.endIndex;
            NSLog(@"shuliang: %lu",(unsigned long)item.count);
            for (int i=0; i<item.count; i++) {
                MTimeTickItem *items = item[i];
                NSString *ty;
                if (items.type == 1){
                    ty = @"B";
                }else if (items.type == 2){
                    ty = @"S";
                }else{
                    ty = @"N";
                }
                [_arr11 addObject: [NSString stringWithFormat:@"交易时间:*%@*,成交价格:*%@*,交易量:*%@*,买卖方向:*%@*",items.time8,items.tradePrice,items.tradeVolume,ty]];
            }
            if (count==100){
//                NSLog(@"````%@",[NSString stringWithFormat:@"%@,100,1",response.endIndex]);
                [self zhubimingxi: [NSString stringWithFormat:@"%@,100,1",response.endIndex]];
            }else{
                NSLog(@"逐笔明细数据如下，共有%lu条数据",(unsigned long)_arr11.count);
                for (int i=0;i<_arr11.count;i++){
                    NSLog(@"result: %@",_arr11[i]);
                }
            }
        } else {
            //应答错误，显示错误信息
            NSLog(@"逐笔明细请求错误，错误信息是：%@",resp.message);
        }
    }];
}
- (void)registerServer {

    [MApi setDebugMode:@{@"token":@"|F)w*7sYaoIdM+!#8d10LsT#0x|cA.xX/a@;a~",@"enabled":@YES,@"mode":@7}];
    [MApi registerAPP:[[NSBundle mainBundle] infoDictionary][@"MApiAppKey"]
    sourcePermissions:@{
                            
                            MApiMarketSH:@(MApiSourceLevel1),
                            MApiMarketSZ:@(MApiSourceLevel1),
//                            MApiMarketSH:@(MApiSourceLevel),
//                            MApiMarketSZ:@(MApiSourceLevel2),
//                            MApiMarketCSI:@(MApiSourceLevel1),
//                            MApiMarketSH:@(MApiSourceOLLevel2),
//                            MApiMarketSZ:@(MApiSourceOLLevel2),
//                            MApiMarketSZ:@(MApiSourceOLLevel1),
//
                            MApiMarketBK:@(MApiSourceLevel1),
                            MApiMarketBJ:@(MApiSourceLevel1),
                            MApiMarketHK:@(MApiSourceHK10),
                            MApiMarketCFF:@(MApiSourceCFF2),
                            MApiMarketDCE:@(MApiSourceDCE2),
                            MApiMarketCZCE:@(MApiSourceCZCE2),
                            MApiMarketSHFE:@(MApiSourceSHFE2),
                            MApiMarketINE:@(MApiSourceINE2)
                        }
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120}
     
     // 逐笔委托等测试
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.134:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{ @"pb":@[@{@"ip":@"http://114.80.155.49:22016"}],                                                           @"szl2":@[@{@"ip":@"http://114.80.155.49:22016"},@{@"ip":@"tcp://114.80.155.49:22017"}],
//                @"szplus":@[@{@"ip":@"http://114.80.155.49:22016"},@{@"ip":@"tcp://114.80.155.49:22017"}],
//                @"shl2":@[@{@"ip":@"http://114.80.155.49:22016"},@{@"ip":@"tcp://114.80.155.49:22017"}],
//               @"shplus":@[@{@"ip":@"http://114.80.155.49:22016"},@{@"ip":@"tcp://114.80.155.49:22017"}], @"nfcls":@[@{@"ip":@"http://114.80.155.49:22013"},@{@"ip":@"tcp://114.80.155.49:22017"}],
//              }}

////////     L2shplus公网沈阳C1
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.134:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{ @"pb":@[@{@"ip":@"http://124.95.141.40:22016"}],
//                @"shl2":@[@{@"ip":@"http://124.95.141.40:22016"},@{@"ip":@"tcp://124.95.141.40:22017"}],
//               @"shplus":@[@{@"ip":@"http://124.95.141.40:22016"},@{@"ip":@"tcp://124.95.141.40:22017"}],
//              }}
////     SHPLUS公网上海C14
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.134:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{ @"pb":@[@{@"ip":@"http://124.95.141.40:22016"}],
//                              @"shl2":@[@{@"ip":@"http://222.73.20.93:22016"},@{@"ip":@"tcp://222.73.20.93:22017"}],
//                             @"shplus":@[@{@"ip":@"http://222.73.20.93:22016"},@{@"ip":@"tcp://222.73.20.93:22017"}],
//                            }}
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.134:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{ @"pb":@[@{@"ip":@"http://114.80.155.61:7710"}],
//                              @"shl2":@[@{@"ip":@"http://114.80.155.61:7710"},@{@"ip":@"tcp://114.80.155.61:7711"}],
//                             @"shplus":@[@{@"ip":@"http://114.80.155.61:7710"},@{@"ip":@"tcp://114.80.155.61:7711"}],
//                            }}
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.62:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{ @"pb":@[@{@"ip":@"http://114.80.155.55:22016"}],
//                                            @"szl2":@[@{@"ip":@"http://114.80.155.55:22016"},@{@"ip":@"tcp://114.80.155.55:22017"}],
//                                           @"szplus":@[@{@"ip":@"http://114.80.155.55:22016"},@{@"ip":@"tcp://114.80.155.55:22017"}],
//                                          }}

//
     
     
////         福州生产
//////////////
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_QUOTE_SERVERS":@{@"sz":@[@{@"ip":@"http://27.151.2.87:22016"}],@"pb":@[@{@"ip":@"http://27.151.2.87:22016"}],@"bj":@[@{@"ip":@"http://27.151.2.87:22016"}],@"sh":@[@{@"ip":@"http://27.151.2.87:22016"}],@"nf":@[@{@"ip":@"http://27.151.2.87:22016"}],@"cf":@[@{@"ip":@"http://27.151.2.87:22016"}]
//
//              }}
//
//////     金桥L1
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_QUOTE_SERVERS":@{@"sz":@[@{@"ip":@"http://140.207.241.151:22016"}],@"pb":@[@{@"ip":@"http://140.207.241.151:22016"}],@"bj":@[@{@"ip":@"http://140.207.241.151:22016"}],@"sh":@[@{@"ip":@"http://140.207.241.151:22016"}]}}
//////
//  生产   上海L1
     
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_QUOTE_SERVERS":@{@"sz":@[@{@"ip":@"http://180.163.112.216:22016"}],@"pb":@[@{@"ip":@"http://180.163.112.216:22016"}],@"bj":@[@{@"ip":@"http://180.163.112.216:22016"}],@"sh":@[@{@"ip":@"http://180.163.112.216:22016"}]}}
//
////     金桥深L2
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_QUOTE_SERVERS":@{@"szl2":@[@{@"ip":@"http://140.207.241.153"}],@"pb":@[@{@"ip":@"http://140.207.241.153"}],@"bj":@[@{@"ip":@"http://140.207.241.153"}],@"shl2":@[@{@"ip":@"http://140.207.241.153"}]}}
     
//     金桥沪L2
////
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_QUOTE_SERVERS":@{@"shl2":@[@{@"ip":@"http://140.207.241.152:22016"}],@"pb":@[@{@"ip":@"http://140.207.241.152:22016"}],@"bj":@[@{@"ip":@"http://140.207.241.152:22016"}],@"shl2":@[@{@"ip":@"http://140.207.241.152:22016"}]}}
////

////     信创全真
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.134:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{ @"pb":@[@{@"ip":@"114.80.63.252:22016"}],@"sh":@[@{@"ip":@"114.80.63.252:22016"}],@"sz":@[@{@"ip":@"114.80.63.252:22016"}],
//
//                            }}
////////     202107特回放
//                 options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.50:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{ @"pb":@[@{@"ip":@"114.80.155.50:22016"}],@"shl2":@[@{@"ip":@"114.80.155.50:22016"}],@"sz":@[@{@"ip":@"114.80.155.50:22016"}],
//                               }}
     
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.62:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{ @"pb":@[@{@"ip":@"114.80.155.62:22016"}],@"shl2":@[@{@"ip":@"114.80.155.62:22016"}],@"sz":@[@{@"ip":@"114.80.155.62:22016"}],
//                                             }}
////
     
////
//////     中创环境
//                    options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.134:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{ @"pb":@[@{@"ip":@"61.152.149.1:22016"}],@"sh":@[@{@"ip":@"61.152.149.1:22016"}],@"sz":@[@{@"ip":@"61.152.149.1:22016"}],@"bz":@[@{@"ip":@"61.152.149.1:22016"}]
//                                  }}

////
//                 options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.61:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{ @"pb":@[@{@"ip":@"http://114.80.155.61:22016"}], @"sh":@[@{@"ip":@"http://114.80.155.61:22016"},@{@"ip":@"tcp://114.80.155.61:22017"}],
//                    @"bz":@[@{@"ip":@"http://114.80.155.61:22016"},@{@"ip":@"tcp://114.80.155.61:22017"}],
//                    @"sz":@[@{@"ip":@"http://114.80.155.61:22016"}],@"szl2":@[@{@"ip":@"http://114.80.155.57:22016"}],    @"shl2":@[@{@"ip":@"http://114.80.155.50:22016"},@{@"ip":@"tcp://114.80.155.50:22017"}],
//               } }
              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120
                            ,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.134:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{ @"pb":@[@{@"ip":@"http://114.80.155.134:22016"}], @"sh":@[@{@"ip":@"http://114.80.155.134:22016"},@{@"ip":@"tcp://114.80.155.134:22017"}], @"shl2":@[@{@"ip":@"http://114.80.155.62:22016"},@{@"ip":@"tcp://114.80.155.62:22017"}], @"shplus":@[@{@"ip":@"http://114.80.155.49:22016"}], @"sz":@[@{@"ip":@"http://114.80.155.134:22016"},@{@"ip":@"tcp://114.80.155.134:22017"}], @"szl2":@[@{@"ip":@"http://114.80.155.57:22016"},@{@"ip":@"tcp://114.80.155.57:22017"}], @"szplus":@[@{@"ip":@"http://114.80.155.48:22016"}], @"hk":@[@{@"ip":@"http://58.63.252.56:22016"}], @"hk1":@[@{@"ip":@"http:/58.63.252.56:22016"}], @"hk5":@[@{@"ip":@"http://114.80.155.58:8601"}], @"hk10":@[@{@"ip":@"http://114.80.155.133:22016"}], @"hka1":@[@{@"ip":@"http://114.80.155.58:8601"}], @"hkd1":@[@{@"ip":@"http://114.80.155.58:8601"}],  @"hkaz":@[@{@"ip":@"http://58.63.252.56:22016"}], @"hkdz":@[@{@"ip":@"http://58.63.252.56:22016"}], @"cff":@[@{@"ip":@"http://114.80.155.61:22016"}], @"cf":@[@{@"ip":@"http://114.80.155.61:22016"}], @"gf":@[@{@"ip":@"http://114.80.155.61:22016"}], @"fe":@[@{@"ip":@"http://114.80.155.61:22016"}], @"bz":@[@{@"ip":@"http://114.80.155.134:22016"}], @"bj":@[@{@"ip":@"http://114.80.155.134:22016"}], @"nf":@[@{@"ip":@"http://114.80.155.57:22013"}],
                                @"kfpt":@[@{@"ip":@"https://yunqzly.sseinfo.com:22011"}],
                            }}
////////////////
     
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.61:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{ @"pb":@[@{@"ip":@"http://114.80.155.61:22016"}],
//        @"szl2":@[@{@"ip":@"http://114.80.155.57:22016"}],    @"shl2":@[@{@"ip":@"http://114.80.155.50:22016"},@{@"ip":@"tcp://114.80.155.50:22017"}],
//            } }
//options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.134:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{@"pb":@[@{@"ip":@"http://114.80.155.134:22016"}], @"sh":@[@{@"ip":@"http://114.80.155.134:22016"},@{@"ip":@"tcp://114.80.155.134:22017"}],@"csi":@[@{@"ip":@"http://114.80.155.134:22016"},@{@"ip":@"tcp://114.80.155.134:22017"}], @"shl2":@[@{@"ip":@"http://114.80.155.62:22016"},@{@"ip":@"tcp://114.80.155.62:22017"}], @"bz":@[@{@"ip":@"http://114.80.155.134:22016"},@{@"ip":@"tcp://114.80.155.134:22017"}], @"szl2":@[@{@"ip":@"http://114.80.155.47:22016"},@{@"ip":@"tcp://114.80.155.47:22017"}],
//                                                                                                                                                    @"sz":@[@{@"ip":@"http://114.80.155.134:22016"},@{@"ip":@"tcp://114.80.155.134:22017"}],   @"hk":@[@{@"ip":@"http://114.80.155.133:22016"}], @"hk1":@[@{@"ip":@"http://114.80.155.133:22016"}],                                                                    @"hk5":@[@{@"ip":@"http://114.80.155.133:22016"}], @"hk10":@[@{@"ip":@"http://114.80.155.133:22016"}],                                                                   @"hka1":@[@{@"ip":@"http://114.80.155.133:22016"}], @"hkd1":@[@{@"ip":@"http://114.80.155.139:22016"}], @"hkl2":@[@{@"ip":@"http://114.80.155.133:22016"}], @"hkaz":@[@{@"ip":@"http://114.80.155.133:22016"}], @"hkdz":@[@{@"ip":@"http://114.80.155.139:22016"}],                                                        @"shfe":@[@{@"ip":@"http://114.80.155.134:22016"}], @"cff":@[@{@"ip":@"http://114.80.155.134:22016"}], @"cf":@[@{@"ip":@"http://114.80.155.134:22016"}], @"gf":@[@{@"ip":@"http://114.80.155.134:22016"}], @"fe":@[@{@"ip":@"http://114.80.155.134:22016"}], @"bj":@[@{@"ip":@"http://114.80.155.134:22016"}], @"nf":@[@{@"ip":@"http://114.80.155.134:22013"}]
//}}
     //福州L2
////////////
//     options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.134:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{@"pb":@[@{@"ip":@"http://114.80.155.134:22016"}], @"sh":@[@{@"ip":@"http://27.151.2.88:22016"},@{@"ip":@"tcp://27.151.2.88:22017"}],@"csi":@[@{@"ip":@"http://27.151.2.88:22016"},@{@"ip":@"tcp://27.151.2.88:22017"}], @"shl2":@[@{@"ip":@"http://27.151.2.88:22016"},@{@"ip":@"tcp://27.151.2.88:22017"}],
//     }}
//              options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.134:22016"],@"MAPI_DEBUG_QUOTE_SERVERS":@{@"pb":@[@{@"ip":@"http://114.80.155.134:22016"}], @"sh":@[@{@"ip":@"http://114.80.155.134:22016"},@{@"ip":@"tcp://114.80.155.134:22017"}],@"csi":@[@{@"ip":@"http://114.80.155.134:22016"},@{@"ip":@"tcp://114.80.155.134:22017"}], @"shl2":@[@{@"ip":@"http://114.80.155.62:22016"},@{@"ip":@"tcp://114.80.155.62:22017"}], @"sz":@[@{@"ip":@"http://114.80.155.134:22016"},@{@"ip":@"tcp://114.80.155.134:22017"}], @"szl2":@[@{@"ip":@"http://114.80.155.47:22016"},@{@"ip":@"tcp://114.80.155.47:22017"}]
//              }}
////     options:@{MApiRegisterOptionGetServerPoolingTimeKey:@120,@"MAPI_DEBUG_AUTH_SERVERS":@[@"http://114.80.155.58:22016"],
//               @"MAPI_DEBUG_QUOTE_SERVERS":@{@"pb":@[@{@"ip":@"http://114.80.155.58:22016"}],                                    @"sh":@[@{@"ip":@"http://114.80.155.58:22016"},@{@"ip":@"tcp://114.80.155.58:22017"}], @"shl2":@[@{@"ip":@"http://114.80.155.50:22016"},@{@"ip":@"tcp://114.80.155.50:22017"}], @"sz":@[@{@"ip":@"http://114.80.155.58:22016"},@{@"ip":@"tcp://114.80.155.58:22017"}], @"bj":@[@{@"ip":@"http://114.80.155.58:22016"},@{@"ip":@"tcp://114.80.155.58:22017"}], @"szl2":@[@{@"ip":@"http://114.80.155.47:22016"},@{@"ip":@"tcp://114.80.155.47:22017"}], @"dce":@[@{@"ip":@"http://114.80.155.58:22016"},@{@"ip":@"tcp://114.80.155.58:22017"}],
//         @"hk10":@[@{@"ip":@"http://114.80.155.58:8601"}]
//     }}
//
     

    completionHandler:^(NSError *error) {
//        Class class = NSClassFromString(@"MAuthRequest");
//        MRequest *request = [class new];
//        NSLog(@"%@",[request performSelector:@selector(postParam) withObject:nil]);
        if (!error) {

            NSLog(@"注册成功");
            NSLog(@"version:%@",[MApi version]);
            if([MApi isChinaUser]==YES){
                NSLog(@"是否是境内:是");
            }else if([MApi isChinaUser]==NO){
                NSLog(@"是否是境内:否");
            }else{
                NSLog(@"是否是境内:无");
            }
            
//            NSArray *serverList =  [MApi serverListWithMarket:MApiMarketHK permission:MApiSourceHKDZ];
//            NSLog(@"IP地址列表%@",serverList);
////            NSArray *List = [NSArray arrayWithObjects:@"http://114.80.155.134:22016",@"http://114.80.155.133:22016",nil];
//            [MApi resetServerList:serverList withMarket:MApiMarketSH permission:MApiSourceLevel1];
//            for (int num=0;num<serverList.count;num++) {
////                NSLog(@"%lu",serverList.count);
//                MPingRequest *request = [[MPingRequest alloc] init];
//
//                request.URLString = serverList[num];
////                NSLog(@"%@",serverList[num]);
//                //发送请求
//                [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//                    if (resp.status==MResponseStatusSuccess) {
//                        MPingResponse *response = (MPingResponse *)resp;
//                        NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                        self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////                        NSLog(@"1----%@",response);
//                        NSString   *items = response.IPAddress;
//                        NSTimeInterval   Arrs = response.responseTime;
//                        NSLog(@"IP地址：%@,响应时间：%f",items,Arrs);
//
//                    } else {
//                        //应答错误，显示错误信息
//                        NSLog(@"获取资讯源类别请求错误，错误信息是：%@",resp.message);
//                    }
//
//                }];
//
//
//            }

        }
        else {
            NSLog(@"注册失败, %@", error);
            NSLog(@"version:%@",[MApi version]);
            if([MApi isChinaUser]==YES){
                NSLog(@"是否是境内:是");
            }else if([MApi isChinaUser]==NO){
                NSLog(@"是否是境内:否");
            }else{
                NSLog(@"是否是境内:无");
            }
            UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:[error localizedDescription] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
            [alert show];
        }
    }];

    //练习:版本检查
//    MCheckVersionRequest *request = [[MCheckVersionRequest alloc] init];
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status==MResponseStatusSuccess) {
//            MCheckVersionResponse *response = (MCheckVersionResponse *)resp;
//            //NSDictionary * data=response.sourceClassInfos;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1=====:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"版本检查请求错误，错误信息是：%@",resp.message);
//        }
//
//    }];
    
    //练习:获取资讯源类别
//    MGetSourceRequest *request = [[MGetSourceRequest alloc] init];
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status==MResponseStatusSuccess) {
//            MGetSourceResponse *response = (MGetSourceResponse *)resp;
//            //            NSDictionary * data=response.sourceClassInfos;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"获取资讯源类别请求错误，错误信息是：%@",resp.message);
//        }
//
//    }];
    
    //获取各市场站点
//    NSArray *serverList;
//    NSArray *market = @[@"sh"];
//    NSArray *level = @[@"MApiSourceLevel1"];
//    for (int i=0; i<market.count; i++) {
//        serverList =  [MApi serverListWithMarket:market[i] permission:level[i]];
//        NSLog(@"IP地址列表%@",serverList);
//    }
    
//    NSArray *serverList =  [MApi serverListWithMarket:MApiMarketSH permission:MApiSourceLevel1];
//    NSLog(@"IP地址列表%@",serverList);
    
    //切换指定市场连接站点
//    [MApi resetServerList:serverList withMarket:MApiMarketSH permission:MApiSourceLevel2];
    
    
    //站点测速
//    MPingRequest *request = [[MPingRequest alloc] init];
//    request.URLString = serverList[0];
//    NSLog(@"%@",serverList[0]);
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status==MResponseStatusSuccess) {
//            MPingResponse *response = (MPingResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSString   *items = response.IPAddress;
//            NSTimeInterval  Arrs = response.responseTime;
//            NSLog(@"IP地址：%@,响应时间：%f",items,Arrs);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"获取资讯源类别请求错误，错误信息是：%@",resp.message);
//        }
//
//    }];
    
    //练习:获取行情分类
//    MGetSourceClassRequest *request = [[MGetSourceClassRequest alloc] init];
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status==MResponseStatusSuccess) {
//            MGetSourceClassResponse *response = (MGetSourceClassResponse *)resp;
//            //      NSDictionary * data=response.sourceClassInfos;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1=====:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"获取行情分类请求错误，错误信息是：%@",resp.message);
//        }
//
//    }];
    
    //练习:获取主选单分类
//    MGetMenuRequest *request = [[MGetMenuRequest alloc] init];
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status==MResponseStatusSuccess) {
//            MGetMenuResponse *response = (MGetMenuResponse *)resp;
//            //            NSDictionary * data=response.sourceClassInfos;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"获取主选单分类请求错误，错误信息是：%@",resp.message);
//        }
//
//    }];
    
    //练习:获取公告
//    MAnnouncementRequest *request = [[MAnnouncementRequest alloc] init];
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status==MResponseStatusSuccess) {
//            MAnnouncementResponse *response = (MAnnouncementResponse *)resp;
//            //            NSDictionary * data=response.sourceClassInfos;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"获取公告请求错误，错误信息是：%@",resp.message);
//        }
//
//    }];
    
  
//    //600000.sh,688001.sh,300182.sz,900907.sh,430021.bj,830821.bj,08153.hk,67934.hk,AUDUSD.gb,M00003.gb，KIC2006.cff,TF2009.cff,a2003.dce,c2005-C-2120.dce,ag2003.shfe,ru2001C14750.shfe,AP001.czce,CF003C13000.czce,nr2006.ine
    
////    //练习:真证券行情列表
//        MQuoteRequest *request = [[MQuoteRequest alloc] init];
//        request.code = @"430047.bz,832089.bz"; //填入股票代码
//    request.stockFields = nil;
//    request.addValueFields =nil;
//        //发送请求
//        [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//            if (resp.status == MResponseStatusSuccess) {
//                //应答无误，处理数据更新画面
//                MQuoteResponse *response = (MQuoteResponse *)resp;
//                NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//                NSArray *item = response.stockItems;
//                for (int i=0; i<item.count; i++) {
//                    MStockItem *items = item[i];
////                    NSLog(@"股票代码：%@,5日涨跌幅：%@,10日涨跌幅：%@,20日涨跌幅：%@,5日换手率：%@,10日换手率：%@,20日换手率：%@",items.ID,items.changeRate5,items.changeRate10,items.changeRate20,items.turnoverRate5,items.turnoverRate10,items.turnoverRate20);
//                              NSLog(@"股票状态：%ld",(long)items.status);
//                               NSLog(@"交易阶段：%ld",(long)items.stage);
//                               NSLog(@"证券状态：%@",items.securityStatus);
//                               NSLog(@"股票代码：%@",items.ID);
//                               NSLog(@"交易时间：%@",items.datetime);
//                               NSLog(@"市场别：%@",items.market);
//                               NSLog(@"次类别：%@",items.subtype);
//                               NSLog(@"详细证券类别参考：%@",items.sect);
//                               NSLog(@"股票最后交易日字段：%@",items.tsr);
//                               NSLog(@"最新价：%@",items.lastPrice);
//                               NSLog(@"最高价：%@",items.highPrice);
//                               NSLog(@"最低价：%@",items.lowPrice);
//                               NSLog(@"今开价：%@",items.openPrice);
//                               NSLog(@"昨收价：%@",items.preClosePrice);
//                               NSLog(@"均价：%@",items.averagePrice);
//                               NSLog(@"涨跌比率：%@",items.changeRate);
//                               NSLog(@"5日涨跌幅：%@",items.changeRate5);
//                               NSLog(@"10日涨跌幅：%@",items.changeRate10);
//                               NSLog(@"20日涨跌幅：%@",items.changeRate20);
//                               NSLog(@"本月涨跌幅：%@",items.monthChangeRate);
//                               NSLog(@"本年涨跌幅：%@",items.yearChangeRate);
//                               NSLog(@"近月涨跌幅：%@",items.nMonthChangeRate);
//                               NSLog(@"近年涨跌幅：%@",items.nYearChangeRate);
//                               NSLog(@"总量：%@",items.volume);
//                               NSLog(@"当前成交量：%@",items.nowVolume);
//                               NSLog(@"最新一根分时成交量：%@",items.lastMinuteVolume);
//                               NSLog(@"换手率：%@",items.turnoverRate);
//                               NSLog(@"5日换手率：%@",items.turnoverRate5);
//                               NSLog(@"10日换手率：%@",items.turnoverRate10);
//                               NSLog(@"20日换手率：%@",items.turnoverRate20);
//                               NSLog(@"涨停价：%@",items.limitUp);
//                               NSLog(@"跌停价：%@",items.limitDown);
//                               NSLog(@"涨停板百分比：%@",items.limitUpChangeRate);
//                               NSLog(@"跌停板百分比：%@",items.limitDownChangeRate);
//                               NSLog(@"涨跌：%@",items.change);
//                               NSLog(@"成交金额：%@",items.amount);
//                               NSLog(@"买一价：%@",items.buyPrice);
//                               NSLog(@"卖一价：%@",items.sellPrice);
//                               NSLog(@"买一量：%@",items.buyVolume1);
//                               NSLog(@"卖一量：%@",items.sellVolume1);
//                               NSLog(@"外盘量：%@",items.buyVolume);
//                               NSLog(@"内盘量：%@",items.sellVolume);
//                               NSLog(@"总值：%@",items.totalValue);
//                               NSLog(@"流通市值：%@",items.flowValue);
//                               NSLog(@"净资产：%@",items.netAsset);
//                               NSLog(@"PE(市盈 动)：%@",items.PE);
//                               NSLog(@"PE(市盈 静)：%@",items.SPE);
//                               NSLog(@"ROE(市净率) （英文简写和PBR弄反了，不要再纠结了，这里ROE就是市净率）：%@",items.ROE);
//                               NSLog(@"TTM(市盈率)：%@",items.TTM);
//                               NSLog(@"净资产收益率 （英文简写和ROE弄反了，不要再纠结了，这里PBR就是净资产收益率）：%@",items.PBR);
//                               NSLog(@"上市日期：%@",items.listingDate);
//                               NSLog(@"总股本：%@",items.capitalization);
//                               NSLog(@"流通股：%@",items.circulatingShare);
//                               NSLog(@"价，买10 -> 买1：%@",items.buyPrices);
//                               NSLog(@"量，买10 -> 买1：%@",items.sellPrices);
//                               NSLog(@"笔数，买10 -> 买1：%@",items.buyVolumes);
//                               NSLog(@"价，卖1 -> 卖10：%@",items.sellVolumes);
//                               NSLog(@"量，卖1 -> 卖10：%@",items.buyCount);
//                               NSLog(@"笔数，卖1 -> 卖10：%@",items.sellCount);
//                               NSLog(@"价，买1 -> 买10：%@",items.buyPricesReverse);
//                               NSLog(@"量，买1 -> 买10：%@",items.buyVolumesReverse);
//                               NSLog(@"笔数，买1 -> 买10：%@",items.buyCountReverse);
//                               NSLog(@"委比：%@",items.orderRatio);
//                               NSLog(@"委差：%@",items.entrustDiff);
//                               NSLog(@"量比：%@",items.volumeRatio);
//                               NSLog(@"振幅比率：%@",items.amplitudeRate);
//                               NSLog(@"收益：%@",items.receipts);
//                               NSLog(@"每股收益：%@",items.EPS);
//                               NSLog(@"每股收益所属报告期：%@",items.EPSType);
//                               NSLog(@"股票代码：%@",items.code);
//                               NSLog(@"涨跌状态：%lu",(unsigned long)items.changeState);
//                               NSLog(@"风险警示标识：%ld",(long)items.FXFlag);
//                               NSLog(@"退市整理标识：%ld",(long)items.TSFlag);
//                               NSLog(@"涨跌限制标识：%@",items.UDFlag);
//                               NSLog(@"限价买数量上限（仅深交所有值）：%@",items.buyQtyUpperLimit);
//                               NSLog(@"限价卖数量上限（仅深交所有值）：%@",items.sellQtyUpperLimit);
//                               NSLog(@"市价卖数量上限（仅深交所有值）：%@",items.marketBuyQtyUpperLimit);
//                               NSLog(@"市价卖数量上限（仅深交所有值）：%@",items.marketSellQtyUpperLimit);
//                               NSLog(@"买数量上限（盘后定价交易业务参考信息）（仅深交所有值）：%@",items.AFBuyQtyUpperLimit);
//                               NSLog(@"卖数量上限（盘后定价交易业务参考信息）（仅深交所有值）：%@",items.AFSellQtyUpperLimit);
//                               NSLog(@"是否注册制：%ld",(long)items.REGFlag);
//                               NSLog(@"是否具有协议控制架构：%ld",(long)items.VIEFlag);
//                               NSLog(@"市场化转融通标识，YES：实施，NO：不实施：%ld",(long)items.MFFlag);
//                               NSLog(@"限售股份出借标志，YES：允许出借，NO：不允许出借：%ld",(long)items.RSLFFlag);
//                               NSLog(@"做市商标志，YES：有做市商，NO：没有：%ld",(long)items.MMFFlag);
//                               NSLog(@"买有效竞价范围：%@",items.buyActionRange);
//                               NSLog(@"卖有效竞价范围：%@",items.sellActionRange);
//                               NSLog(@"市价申报上限：%@",items.subscribeLimit);
//                               NSLog(@"市价申报下限：%@",items.subscribeLowerLimit);
//                               NSLog(@"盘后成交量：%@",items.afterHoursVolume);
//                               NSLog(@"盘后成交额：%@",items.afterHoursAmount);
//                               NSLog(@"盘后成交笔数：%@",items.afterHoursTransactionNumber);
//                               NSLog(@"盘后撤单买笔数：%@",items.afterHoursWithdrawBuyCount);
//                               NSLog(@"盘后撤单买数量：%@",items.afterHoursWithdrawBuyVolume);
//                               NSLog(@"盘后撤单卖笔数：%@",items.afterHoursWithdrawSellCount);
//                               NSLog(@"盘后撤单卖数量：%@",items.afterHoursWithdrawSellVolume);
//                               NSLog(@"盘后委托买入总量：%@",items.afterHoursBuyVolume);
//                               NSLog(@"盘后委托卖出总量：%@",items.afterHoursSellVolume);
//                               NSLog(@"投票权差异：%ld",(long)items.voteFlag);
//                               NSLog(@"盈利状态：%ld",(long)items.unprofitableFlag);
//                               NSLog(@"注册资本：%@",items.regCapital);
//                               NSLog(@"中文证券名称 (长)：%@",items.longName);
//                               NSLog(@"限价申报数量上限 单位股：%@",items.PLSubscribeLimit);
//                               NSLog(@"限价申报数量下限 单位股：%@",items.PLSubscribeLowerLimit);
//                               NSLog(@"可转债联动代码：%@",items.linkCode);
//                               NSLog(@"AB股联动代码：%@",items.abCode);
//                               NSLog(@"加权平均价：%@",items.weightedAveragePrice);
//                               NSLog(@"加权平均涨跌BP：%@",items.BP);
//                               NSLog(@"昨收盘加权平均价：%@",items.weightedAveragePreClosePrice);
//                               NSLog(@"债券合格投资者是否要求：%ld",(long)items.investorRequirementsFlag);
//                               NSLog(@"债券对投资者的要求级别：%ld",(long)items.investorRequirementsType);
//                               NSLog(@"回购期限：%@",items.termRepo);
//                               NSLog(@"占款天数：%@",items.takeUpDays);
//                               NSLog(@"资金可用日期：%@",items.fundAvailableDate);
//                               NSLog(@"资金可取日期：%@",items.fundReceiptedDate);
//                               NSLog(@"最新价涨跌BP：%@",items.changeBP);
//                               NSLog(@"港股信息状态：%lu",(unsigned long)items.HKInfoStatus);
//                               NSLog(@"沪港通标识：%ld",(long)items.HFlag);
//                               NSLog(@"深港通标识：%ld",(long)items.SFlag);
//                               NSLog(@"融资标识：%ld",(long)items.financeFlag);
//                               NSLog(@"融券标识：%ld",(long)items.securityFlag);
//                               NSLog(@"同一只股票多市场 次类别：%@",items.subtypes);
//                               NSLog(@"港股最小交易单位：%@",items.HKMinTradeUnit);
//                               NSLog(@"法定股本：%@",items.authorisedCapital);
//                               NSLog(@"港股股本：%@",items.HKCapital);
//                               NSLog(@"港股市值：%@",items.HKValue);
//                               NSLog(@"是否参与集合竞价：%ld",(long)items.CASFlag);
//                               NSLog(@"是否参与VCM：%ld",(long)items.VCMFlag);
//                               NSLog(@"是否参与POS：%ld",(long)items.POSFlag);
//                               NSLog(@"是否是AH股标识：%ld",(long)items.AHFlag);
//                               NSLog(@"沪股通标识：%ld",(long)items.HGFlag);
//                               NSLog(@"深股通标识：%ld",(long)items.SGFlag);
//                               NSLog(@"港股通是否可交易：%ld",(long)items.tradeType);
//                               NSLog(@"仓差：%@",items.posDiff);
//                               NSLog(@"挂牌类型：%@",items.GPLX);
//                               NSLog(@"行权方式：%@",items.exeType);
//                               NSLog(@"是否为指数股票：%@",items.index?@"是":@"否");
//                               NSLog(@"是否为香港股票：%@",items.hongKong?@"是":@"否");
//                               NSLog(@"是否为债券股票：%@",items.bond?@"是":@"否");
//                               NSLog(@"是否为基金股票：%@",items.fund?@"是":@"否");
//                               NSLog(@"是否为权证股票：%@",items.wrnt?@"是":@"否");
//                               NSLog(@"是否为期权股票：%@",items.option?@"是":@"否");
//                               NSLog(@"是否为中金所股票：%@",items.cff?@"是":@"否");
//                               NSLog(@"上涨家数：%@",items.advanceCount);
//                               NSLog(@"下跌家数：%@",items.declineCount);
//                               NSLog(@"平盘家数：%@",items.equalCount);
//                               NSLog(@"总买量：%@",items.totalBuyVolume);
//                               NSLog(@"总卖量：%@",items.totalSellVolume);
//                               NSLog(@"买入加权平均价：%@",items.averageBuyPrice);
//                               NSLog(@"卖出加权平均价：%@",items.averageSellPrice);
//                               NSLog(@"买入撤单笔数：%@",items.withdrawBuyCount);
//                               NSLog(@"买入撤单数量：%@",items.withdrawBuyVolume);
//                               NSLog(@"买入撤单金额：%@",items.withdrawBuyAmount);
//                               NSLog(@"卖出撤单笔数：%@",items.withdrawSellCount);
//                               NSLog(@"卖出撤单数量：%@",items.withdrawSellVolume);
//                               NSLog(@"卖出撤单金额：%@",items.withdrawSellAmount);
//                               NSLog(@"基金净值：%@",items.IOPV);
//                               NSLog(@"基金净值参考价：%@",items.preIOPV);
//                               NSLog(@"类别2：%@",items.subtype2);
//                               NSLog(@"发行市盈率：%@",items.issuePE);
//                               NSLog(@"做市商数量：%@",items.marketMakerQty);
//                               NSLog(@"非限售股本：%@",items.unRestrictedShareCapital);
//                               NSLog(@"转让状态：%@",items.ZRZT);
//                               NSLog(@"转让类型：%@",items.ZRLX);
//                               NSLog(@"除权出息：%@",items.CQCX);
//                               NSLog(@"证券级别：%@",items.ZQJB);
//                               NSLog(@"基础证券标的证券：%@",items.underlyingSecurity);
//                               NSLog(@"挂牌日期：%@",items.listDate);
//                               NSLog(@"起息日：%@",items.valueDate);
//                               NSLog(@"到期日：%@",items.expiringDate);
//                               NSLog(@"停牌标志：%@",items.TPBZ);
//                               NSLog(@"每笔限量：%@",items.MBXL);
//                               NSLog(@"最小申报数量：%@",items.ZXSBSL);
//                               NSLog(@"其他业务状态：%@",items.QTYW);
//                               NSLog(@"较上一幅涨跌：%@",items.change2);
//                               NSLog(@"基础证券标的券：%@",items.underlyingSecurity);
//                               NSLog(@"挂牌日期：%@",items.listDate);
//                               NSLog(@"起息日：%@",items.valueDate);
//                               NSLog(@"到息日：%@",items.expiringDate);
//                               NSLog(@"买数量单位：%@",items.buyQtyUnit);
//                               NSLog(@"卖数量单位：%@",items.sellQtyUnit);
//                               NSLog(@"每笔限量：%@",items.MBXL);
//                               NSLog(@"最小申报数量：%@",items.ZXSBSL);
//                               NSLog(@"CDR标识：%@",items.DR);
//                               NSLog(@"GDR标识：%@",items.GDR);
//                               NSLog(@"联动代码：%@",items.DRStockCode);
//                               NSLog(@"基础证券名称：%@",items.DRStockName);
//                               NSLog(@"当前份额：%@",items.DRCurrentShare);
//                               NSLog(@"前收盘份额(上一交易日)：%@",items.DRPreviousClosingShare);
//                               NSLog(@"转换基数(用于计算溢价)：%@",items.DRConversionBase);
//                               NSLog(@"基础证券转换基数(用于计算溢价)：%@",items.DRSecuritiesConversionBase);
//                               NSLog(@"存托机构代码：%@",items.DRDepositoryInstitutionCode);
//                               NSLog(@"存托机构名称：%@",items.DRDepositoryInstitutionName);
//                               NSLog(@"标的收盘参考价：%@",items.DRSubjectClosingReferencePrice);
//                               NSLog(@"cdr初始流动性生成起始日：%@",items.DRFlowStartDate);
//                               NSLog(@"cdr初始流动性生成终止日：%@",items.DRFlowEndDate);
//                               NSLog(@"上市日期(CDR或GDR)：%@",items.DRListingDate);
//                               NSLog(@"委买：%@",items.entrustBuyVolume);
//                               NSLog(@"委卖：%@",items.entrustSellVolume);
//                               NSLog(@"权涨幅：%@",items.weightedChange);
//                               NSLog(@"均涨幅：%@",items.averageChange);
//                               NSLog(@"5日涨跌幅：%@",items.changeRate5);
//                            NSLog(@"10日涨跌幅：%@",items.changeRate10);
////                    NSLog(@"%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@",items.datetime,items.ID,items.name,items.lastPrice,items.preClosePrice,items.capitalization,items.totalValue,items.circulatingShare,items.flowValue,items.receipts,items.PE,items.SPE);
////                    NSLog(@"%@",items);
//                }
//            } else {
//                //应答错误，显示错误信息
//                NSLog(@"证券行情列表请求错误，错误信息是：%@",resp.message);
//            }
//        }];
////     练习:行情快照
//    MSnapQuoteRequest *request = [[MSnapQuoteRequest alloc] init];
////
//    request.code = @"832089.bz"; //填入股票代码
//    request.tickCount = 10;//明细条数
////    request.stockFields = @[@"buyPrices",@"sellPrices",@"lastPrice"];
//    request.stockFields = nil;
////    stockfilds传入-1是返回默认字段，nil是全部字
////    request.stockFields = @[@"-1"];
//     request.addValueFields = @[@"-1"];
////    request.addValueFields = nil;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MSnapQuoteResponse *response = (MSnapQuoteResponse *)resp;
////            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
////            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            MStockItem *item = response.stockItem;
////            NSLog(@"%@,%@,%@,%@,%@",item.ID,item.name,item.PLSubscribeLimit,item.PLSubscribeLowerLimit,item.longName);
////            NSLog(@"最新价：%@,明细：%@",item.lastPrice,item.tickItems);
////             NSLog(@"买范围%@,卖%@",item.buyActionRange,item.sellActionRange);
////
//            NSLog(@"股票状态：%ld",(long)item.status);
//            NSLog(@"交易阶段：%ld",(long)item.stage);
//            NSLog(@"证券状态：%@",item.securityStatus);
//            NSLog(@"股票代码：%@",item.ID);
//            NSLog(@"交易时间：%@",item.datetime);
//            NSLog(@"市场别：%@",item.market);
//            NSLog(@"次类别：%@",item.subtype);
//            NSLog(@"详细证券类别参考：%@",item.sect);
//            NSLog(@"股票最后交易日字段：%@",item.tsr);
//            NSLog(@"最新价：%@",item.lastPrice);
//            NSLog(@"最高价：%@",item.highPrice);
//            NSLog(@"最低价：%@",item.lowPrice);
//            NSLog(@"今开价：%@",item.openPrice);
//            NSLog(@"昨收价：%@",item.preClosePrice);
//            NSLog(@"均价：%@",item.averagePrice);
//            NSLog(@"涨跌比率：%@",item.changeRate);
//            NSLog(@"5日涨跌幅：%@",item.changeRate5);
//            NSLog(@"10日涨跌幅：%@",item.changeRate10);
//            NSLog(@"20日涨跌幅：%@",item.changeRate20);
//            NSLog(@"本月涨跌幅：%@",item.monthChangeRate);
//            NSLog(@"本年涨跌幅：%@",item.yearChangeRate);
//            NSLog(@"近月涨跌幅：%@",item.nMonthChangeRate);
//            NSLog(@"近年涨跌幅：%@",item.nYearChangeRate);
//            NSLog(@"总量：%@",item.volume);
//            NSLog(@"当前成交量：%@",item.nowVolume);
//            NSLog(@"最新一根分时成交量：%@",item.lastMinuteVolume);
//            NSLog(@"换手率：%@",item.turnoverRate);
//            NSLog(@"5日换手率：%@",item.turnoverRate5);
//            NSLog(@"10日换手率：%@",item.turnoverRate10);
//            NSLog(@"20日换手率：%@",item.turnoverRate20);
//            NSLog(@"涨停价：%@",item.limitUp);
//            NSLog(@"跌停价：%@",item.limitDown);
//            NSLog(@"涨停板百分比：%@",item.limitUpChangeRate);
//            NSLog(@"跌停板百分比：%@",item.limitDownChangeRate);
//            NSLog(@"涨跌：%@",item.change);
//            NSLog(@"成交金额：%@",item.amount);
//            NSLog(@"买一价：%@",item.buyPrice);
//            NSLog(@"卖一价：%@",item.sellPrice);
//            NSLog(@"买一量：%@",item.buyVolume1);
//            NSLog(@"卖一量：%@",item.sellVolume1);
//            NSLog(@"外盘量：%@",item.buyVolume);
//            NSLog(@"内盘量：%@",item.sellVolume);
//            NSLog(@"总值：%@",item.totalValue);
//            NSLog(@"流通市值：%@",item.flowValue);
//            NSLog(@"净资产：%@",item.netAsset);
//            NSLog(@"PE(市盈 动)：%@",item.PE);
//            NSLog(@"PE(市盈 静)：%@",item.SPE);
//            NSLog(@"ROE(市净率) （英文简写和PBR弄反了，不要再纠结了，这里ROE就是市净率）：%@",item.ROE);
//            NSLog(@"TTM(市盈率)：%@",item.TTM);
//            NSLog(@"净资产收益率 （英文简写和ROE弄反了，不要再纠结了，这里PBR就是净资产收益率）：%@",item.PBR);
//            NSLog(@"上市日期：%@",item.listingDate);
//            NSLog(@"总股本：%@",item.capitalization);
//            NSLog(@"流通股：%@",item.circulatingShare);
//            NSLog(@"价，买10 -> 买1：%@",item.buyPrices);
//            NSLog(@"量，买10 -> 买1：%@",item.sellPrices);
//            NSLog(@"笔数，买10 -> 买1：%@",item.buyVolumes);
//            NSLog(@"价，卖1 -> 卖10：%@",item.sellVolumes);
//            NSLog(@"量，卖1 -> 卖10：%@",item.buyCount);
//            NSLog(@"笔数，卖1 -> 卖10：%@",item.sellCount);
//            NSLog(@"价，买1 -> 买10：%@",item.buyPricesReverse);
//            NSLog(@"量，买1 -> 买10：%@",item.buyVolumesReverse);
//            NSLog(@"笔数，买1 -> 买10：%@",item.buyCountReverse);
//            NSLog(@"委比：%@",item.orderRatio);
//            NSLog(@"委差：%@",item.entrustDiff);
//            NSLog(@"量比：%@",item.volumeRatio);
//            NSLog(@"振幅比率：%@",item.amplitudeRate);
//            NSLog(@"收益：%@",item.receipts);
//            NSLog(@"每股收益：%@",item.EPS);
//            NSLog(@"每股收益所属报告期：%@",item.EPSType);
//            NSLog(@"股票代码：%@",item.code);
//            NSLog(@"涨跌状态：%lu",(unsigned long)item.changeState);
//            NSLog(@"增值指标：%@",item.addValueItem);
//            NSLog(@"最新十笔明细列表：%@",item.tickItems);
//            NSLog(@"风险警示标识：%ld",(long)item.FXFlag);
//            NSLog(@"退市整理标识：%ld",(long)item.TSFlag);
//            NSLog(@"涨跌限制标识：%@",item.UDFlag);
//            NSLog(@"限价买数量上限（仅深交所有值）：%@",item.buyQtyUpperLimit);
//            NSLog(@"限价卖数量上限（仅深交所有值）：%@",item.sellQtyUpperLimit);
//            NSLog(@"市价卖数量上限（仅深交所有值）：%@",item.marketBuyQtyUpperLimit);
//            NSLog(@"市价卖数量上限（仅深交所有值）：%@",item.marketSellQtyUpperLimit);
//            NSLog(@"买数量上限（盘后定价交易业务参考信息）（仅深交所有值）：%@",item.AFBuyQtyUpperLimit);
//            NSLog(@"卖数量上限（盘后定价交易业务参考信息）（仅深交所有值）：%@",item.AFSellQtyUpperLimit);
//            NSLog(@"是否注册制：%ld",(long)item.REGFlag);
//            NSLog(@"是否具有协议控制架构：%ld",(long)item.VIEFlag);
//            NSLog(@"市场化转融通标识，YES：实施，NO：不实施：%ld",(long)item.MFFlag);
//            NSLog(@"限售股份出借标志，YES：允许出借，NO：不允许出借：%ld",(long)item.RSLFFlag);
//            NSLog(@"做市商标志，YES：有做市商，NO：没有：%ld",(long)item.MMFFlag);
//            NSLog(@"买有效竞价范围：%@",item.buyActionRange);
//            NSLog(@"卖有效竞价范围：%@",item.sellActionRange);
//            NSLog(@"市价申报上限：%@",item.subscribeLimit);
//            NSLog(@"市价申报下限：%@",item.subscribeLowerLimit);
//            NSLog(@"盘后成交量：%@",item.afterHoursVolume);
//            NSLog(@"盘后成交额：%@",item.afterHoursAmount);
//            NSLog(@"盘后成交笔数：%@",item.afterHoursTransactionNumber);
//            NSLog(@"盘后撤单买笔数：%@",item.afterHoursWithdrawBuyCount);
//            NSLog(@"盘后撤单买数量：%@",item.afterHoursWithdrawBuyVolume);
//            NSLog(@"盘后撤单卖笔数：%@",item.afterHoursWithdrawSellCount);
//            NSLog(@"盘后撤单卖数量：%@",item.afterHoursWithdrawSellVolume);
//            NSLog(@"盘后委托买入总量：%@",item.afterHoursBuyVolume);
//            NSLog(@"盘后委托卖出总量：%@",item.afterHoursSellVolume);
//            NSLog(@"投票权差异：%ld",(long)item.voteFlag);
//            NSLog(@"盈利状态：%ld",(long)item.unprofitableFlag);
//            NSLog(@"注册资本：%@",item.regCapital);
//            NSLog(@"中文证券名称 (长)：%@",item.longName);
//            NSLog(@"限价申报数量上限 单位股：%@",item.PLSubscribeLimit);
//            NSLog(@"限价申报数量下限 单位股：%@",item.PLSubscribeLowerLimit);
//            NSLog(@"可转债联动代码：%@",item.linkCode);
//            NSLog(@"AB股联动代码：%@",item.abCode);
//            NSLog(@"加权平均价：%@",item.weightedAveragePrice);
//            NSLog(@"加权平均涨跌BP：%@",item.BP);
//            NSLog(@"昨收盘加权平均价：%@",item.weightedAveragePreClosePrice);
//            NSLog(@"债券合格投资者是否要求：%ld",(long)item.investorRequirementsFlag);
//            NSLog(@"债券对投资者的要求级别：%ld",(long)item.investorRequirementsType);
//            NSLog(@"回购期限：%@",item.termRepo);
//            NSLog(@"占款天数：%@",item.takeUpDays);
//            NSLog(@"资金可用日期：%@",item.fundAvailableDate);
//            NSLog(@"资金可取日期：%@",item.fundReceiptedDate);
//            NSLog(@"最新价涨跌BP：%@",item.changeBP);
//            NSLog(@"港股信息状态：%lu",(unsigned long)item.HKInfoStatus);
//            NSLog(@"沪港通标识：%ld",(long)item.HFlag);
//            NSLog(@"深港通标识：%ld",(long)item.SFlag);
//            NSLog(@"融资标识：%ld",(long)item.financeFlag);
//            NSLog(@"融券标识：%ld",(long)item.securityFlag);
//            NSLog(@"同一只股票多市场 次类别：%@",item.subtypes);
//            NSLog(@"港股最小交易单位：%@",item.HKMinTradeUnit);
//            NSLog(@"法定股本：%@",item.authorisedCapital);
//            NSLog(@"港股股本：%@",item.HKCapital);
//            NSLog(@"港股市值：%@",item.HKValue);
//            NSLog(@"是否参与集合竞价：%ld",(long)item.CASFlag);
//            NSLog(@"是否参与VCM：%ld",(long)item.VCMFlag);
//            NSLog(@"是否参与POS：%ld",(long)item.POSFlag);
//            NSLog(@"是否是AH股标识：%ld",(long)item.AHFlag);
//            NSLog(@"沪股通标识：%ld",(long)item.HGFlag);
//            NSLog(@"深股通标识：%ld",(long)item.SGFlag);
//            NSLog(@"港股通是否可交易：%ld",(long)item.tradeType);
//            NSLog(@"仓差：%@",item.posDiff);
//            NSLog(@"挂牌类型：%@",item.GPLX);
//            NSLog(@"行权方式：%@",item.exeType);
//            NSLog(@"是否为指数股票：%@",item.index?@"是":@"否");
//            NSLog(@"是否为香港股票：%@",item.hongKong?@"是":@"否");
//            NSLog(@"是否为债券股票：%@",item.bond?@"是":@"否");
//            NSLog(@"是否为基金股票：%@",item.fund?@"是":@"否");
//            NSLog(@"是否为权证股票：%@",item.wrnt?@"是":@"否");
//            NSLog(@"是否为期权股票：%@",item.option?@"是":@"否");
//            NSLog(@"是否为中金所股票：%@",item.cff?@"是":@"否");
//            NSLog(@"上涨家数：%@",item.advanceCount);
//            NSLog(@"下跌家数：%@",item.declineCount);
//            NSLog(@"平盘家数：%@",item.equalCount);
//            NSLog(@"总买量：%@",item.totalBuyVolume);
//            NSLog(@"总卖量：%@",item.totalSellVolume);
//            NSLog(@"买入加权平均价：%@",item.averageBuyPrice);
//            NSLog(@"卖出加权平均价：%@",item.averageSellPrice);
//            NSLog(@"50笔队列(买)：%@",item.orderQuantityBuyItems);
//            NSLog(@"50笔队列(卖)：%@",item.orderQuantitySellItems);
//            NSLog(@"经济席位(买)：%@",item.brokerSeatBuyItems);
//            NSLog(@"经济席位(卖)：%@",item.brokerSeatSellItems);
//            NSLog(@"买入撤单笔数：%@",item.withdrawBuyCount);
//            NSLog(@"买入撤单数量：%@",item.withdrawBuyVolume);
//            NSLog(@"买入撤单金额：%@",item.withdrawBuyAmount);
//            NSLog(@"卖出撤单笔数：%@",item.withdrawSellCount);
//            NSLog(@"卖出撤单数量：%@",item.withdrawSellVolume);
//            NSLog(@"卖出撤单金额：%@",item.withdrawSellAmount);
//            NSLog(@"基金净值：%@",item.IOPV);
//            NSLog(@"基金净值参考价：%@",item.preIOPV);
//            NSLog(@"类别2：%@",item.subtype2);
//            NSLog(@"发行市盈率：%@",item.issuePE);
//            NSLog(@"做市商数量：%@",item.marketMakerQty);
//            NSLog(@"非限售股本：%@",item.unRestrictedShareCapital);
//            NSLog(@"转让状态：%@",item.ZRZT);
//            NSLog(@"转让类型：%@",item.ZRLX);
//            NSLog(@"除权出息：%@",item.CQCX);
//            NSLog(@"证券级别：%@",item.ZQJB);
//            NSLog(@"基础证券标的证券：%@",item.underlyingSecurity);
//            NSLog(@"挂牌日期：%@",item.listDate);
//            NSLog(@"起息日：%@",item.valueDate);
//            NSLog(@"到期日：%@",item.expiringDate);
//            NSLog(@"停牌标志：%@",item.TPBZ);
//            NSLog(@"每笔限量：%@",item.MBXL);
//            NSLog(@"最小申报数量：%@",item.ZXSBSL);
//            NSLog(@"其他业务状态：%@",item.QTYW);
//            NSLog(@"较上一幅涨跌：%@",item.change2);
//            NSLog(@"基础证券标的券：%@",item.underlyingSecurity);
//            NSLog(@"挂牌日期：%@",item.listDate);
//            NSLog(@"起息日：%@",item.valueDate);
//            NSLog(@"到息日：%@",item.expiringDate);
//            NSLog(@"买数量单位：%@",item.buyQtyUnit);
//            NSLog(@"卖数量单位：%@",item.sellQtyUnit);
//            NSLog(@"每笔限量：%@",item.MBXL);
//            NSLog(@"最小申报数量：%@",item.ZXSBSL);
//            NSLog(@"CDR标识：%@",item.DR);
//            NSLog(@"GDR标识：%@",item.GDR);
//            NSLog(@"联动代码：%@",item.DRStockCode);
//            NSLog(@"基础证券名称：%@",item.DRStockName);
//            NSLog(@"当前份额：%@",item.DRCurrentShare);
//            NSLog(@"前收盘份额(上一交易日)：%@",item.DRPreviousClosingShare);
//            NSLog(@"转换基数(用于计算溢价)：%@",item.DRConversionBase);
//            NSLog(@"基础证券转换基数(用于计算溢价)：%@",item.DRSecuritiesConversionBase);
//            NSLog(@"存托机构代码：%@",item.DRDepositoryInstitutionCode);
//            NSLog(@"存托机构名称：%@",item.DRDepositoryInstitutionName);
//            NSLog(@"标的收盘参考价：%@",item.DRSubjectClosingReferencePrice);
//            NSLog(@"cdr初始流动性生成起始日：%@",item.DRFlowStartDate);
//            NSLog(@"cdr初始流动性生成终止日：%@",item.DRFlowEndDate);
//            NSLog(@"上市日期(CDR或GDR)：%@",item.DRListingDate);
//            NSLog(@"委买：%@",item.entrustBuyVolume);
//            NSLog(@"委卖：%@",item.entrustSellVolume);
//            NSLog(@"权涨幅：%@",item.weightedChange);
//            NSLog(@"均涨幅：%@",item.averageChange);
//            NSLog(@"5日涨跌幅：%@",item.changeRate5);
//            NSLog(@"10日涨跌幅：%@",item.changeRate10);
////            NSLog(@"股票代码%@,时间%@,最新价%@,最高价%@,最低价    %@,今开价%@,昨收价%@",item.ID,item.datetime,item.lastPrice,item.highPrice,item.lowPrice,item.openPrice,item.preClosePrice);
////
////             NSLog(@"------==-=-=--=注册资本：%@,%@,%@,%@",item.buyPrices,item.buyVolumes,item.sellPrices,item.sellVolumes);
////            NSLog(@"------==-=-=--=注册资本%@,%@",item.fundAvailableDate,item.fundReceiptedDate);
////            NSLog(@"股票代码%@,买一量%@,卖一量%@,上市日期%@",item.code,item.buyVolume1,item.sellVolume1,item.listingDate);
//
////            NSLog(@"\ndatetime:%@\nsecurityStatus：%@,\nbuyQtyUpperLimit：%@,\nsellQtyUpperLimit：%@,\nmarketBuyQtyUpperLimit：%@,\nmarketSellQtyUpperLimit：%@,\nbuyActionRange：%@,\nsellActionRange：%@,11\nAFBuyQtyUpperLimit：%@,\nAFSellQtyUpperLimit：%@",item.datetime,item.securityStatus,item.buyQtyUpperLimit,item.sellQtyUpperLimit,item.marketBuyQtyUpperLimit,item.marketSellQtyUpperLimit,item.buyActionRange,item.sellActionRange,item.AFBuyQtyUpperLimit,item.AFSellQtyUpperLimit);
////            NSLog(@"\nbuyActionRange：%@,\nsellActionRange：%@,",item.buyActionRange,item.sellActionRange);
//
////            NSLog(@"市价申报数量上限:%@/市价申报数量下限:%@/限价申报数量上限:%@/限价申报数量下限:%@",item.subscribeLimit,item.subscribeLowerLimit,item.PLSubscribeLimit,item.PLSubscribeLowerLimit);
////
////
////
//            BOOL bond = item.bond;
//            NSLog(@"%@",bond?@"YES":@"NO");
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"回传代码：%ld",(long)resp.status);
//            //NSLog(@"错误站点信息：%@",request.ip);
//            NSLog(@"行情快照请求错误，错误信息是：%@",resp.message);
//        }
//    }];
////     练习:可转债
//               MKZZQuoteListRequest *request = [[MKZZQuoteListRequest alloc] init];
//                 request.pageIndex = 0;
//                 request.pageSize = 400;
//                 request.field = MKZZQuoteListFieldBackPrice;
//                 request.ascending = YES;
//                //发送请求
//                [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//                    if (resp.status == MResponseStatusSuccess) {
//
//                        //应答无误，处理数据更新画面
//                        MKZZQuoteListResponse *response = (MKZZQuoteListResponse *)resp;
//                        NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                        data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//                        NSLog(@"%lu",(unsigned long)response.items.count);
//                        for (int i=0;i<response.items.count;i++){
//                            MKZZQuoteItem* item = response.items[i];
//
//                            NSLog(@"可转债名称：%@,可转债代码：%@,可转债市场%@,可转债次类别：%@,可转债最新价：%@,可转债昨收：%@,可转债涨跌幅：%@,可转债行情时间：%@,正股名称：%@,正股代码：%@,正股市场：%@,正股次类别：%@,正股最新价：%@,正股昨收：%@,正股涨跌幅：%@,正股行情时间：%@,转股溢价率：%@,转股价：%@,转股价值：%@,回售触发价：%@,强赎触发价(小数位4)：%@,到期赎回价(小数位4)：%@",item.nameKZZ,item.codeKZZ,item.marketKZZ
//                                  ,item.subtypeKZZ,item.lastPriceKZZ,item.preClosePriceKZZ,item.changeRateKZZ,item.datetimeKZZ,item.nameZG,item.codeZG,item.marketZG,item.subtypeZG,item.lastPriceZG,item.preClosePriceZG,item.changeRateZG,item.datetimeZG,item.premiumRate,item.conversionPrice,item.conversionValue,item.backPrice,item.ransomPrice,item.expirePrice);
////                               NSLog(@"%@,%@",item.codeKZZ,item.backPrice);
//                        }
//                    } else {
//                        //应答错误，显示错误信息
//                        NSLog(@"可转债接口请求错误，错误信息是：%@",resp.message);
//                    }
//                }];
//练习:正股与可转债联动
//        MLinkQuoteRequet *request = [[MLinkQuoteRequet alloc] init];
//        request.code = @"113050.sh";
//        //发送请求
//        [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//            if (resp.status == MResponseStatusSuccess) {
//                //应答无误，处理数据更新画面
//                MLinkQuoteResponse *response = (MLinkQuoteResponse *)resp;
//                NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//                MLinkItem *item = response.items;
//                NSLog(@"%@",item);
//            } else {
//                //应答错误，显示错误信息
//                NSLog(@"正股与可转债联动接口请求错误，错误信息是：%@",resp.message);
//            }
//        }];
//
////练习:可转债静态详情接口
//  MKZZInfoRequest *request = [[MKZZInfoRequest alloc] init];
//     request.code = @"113610.sh";
//     //发送请求
//     [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//         if (resp.status == MResponseStatusSuccess) {
//             //应答无误，处理数据更新画面
//             MKZZInfoResponse *response = (MKZZInfoResponse *)resp;
//             NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//             data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////               MKZZInfoItem *item = response.item;
//             NSLog(@"正股代码:%@,可转债代码:%@,转股价格(小数位4):%@,转债价格(小数位4):%@,转股代码市场:%@,回售触发价(小数位4):%@,强赎触发价(小数位4):%@,到期赎回价(小数位4):%@,到期日:%@,转股日期%@,发行规模单位（亿元):%@,剩余规模单位（亿元）：%@,网上中签率 (小数位10)%@,股东配售率：%@,是否可转股（0否1是）:%@,是否可回售（0否1是）:%@",response.codeZG,response.code,response.priceZG,response.priceZZ,response.marketZG,response.backPrice,response.ransomPrice,response.expirePrice,response.expireDate,response.dateZG,response.scaleSize,response.remainSize,response.ZQRate,response.PSRate,response.isKZ,response.isHS);
//
////               NSLog(@"盘后定价交易业务参考信息卖数量单位（仅深交所有值）：%@",item.AFSellQtyUnit);
//         } else {
//             //应答错误，显示错误信息
//             NSLog(@"正股与可转债联动接口请求错误，错误信息是：%@",resp.message);
//         }
//     }];



////    要约申购接口
//    MOfferQuoteRequest *request = [[MOfferQuoteRequest alloc] init];
//    request.code = @"839356.bj"; //填入股票代码
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MOfferQuoteResponse *response = (MOfferQuoteResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSArray *item = response.items;
//            NSLog(@"%@",item);
//            for (int i=0; i<item.count; i++) {
//                MOfferItem *arr= item[i];
//                NSLog(@"%@,%@,%@,%@,%@,%@,%@",arr.code,arr.name,arr.offerID,arr.offerName,arr.price,arr.startDate,arr.endDate);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"回传代码：%ld",resp.status);
//            //NSLog(@"错误站点信息：%@",request.ip);
//            NSLog(@"行情快照请求错误，错误信息是：%@",resp.message);
//        }
//    }];

////    要约列表
//    MOfferQuoteListRequest *request =[[MOfferQuoteListRequest alloc] init];
//    request.pageIndex = 0; //第一页
//    request.pageSize = 10;
//    request.ascending = NO;
//    request.field =  MOfferQuoteListEndDate; // 排序栏位
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MOfferQuoteResponse *response = (MOfferQuoteResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSArray *item = response.items;
//            NSLog(@"%lu",(unsigned long)item.count);
//            NSLog(@"%@",item);
//            for (int i=0; i<item.count; i++) {
//                MOfferItem *arr= item[i];
//                NSLog(@"%@,%@,%@,%@,%@,%@,%@",arr.code,arr.name,arr.offerID,arr.offerName,arr.price,arr.startDate,arr.endDate);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"回传代码：%ld",(long)resp.status);
//            // NSLog(@"错误站点信息:%@",resp.request.ip);
//            NSLog(@"要约信息列表请求错误，错误信息是：%@",resp.message);
//        }
//    }];

    //练习:AH联动
//    MAHQuoteRequest *request = [[MAHQuoteRequest alloc] init];
//    request.code = @"01800.hk"; //填入股票代码
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MAHQuoteResponse *response = (MAHQuoteResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//           data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            //NSLog(@"1=====:%@",response);
////            NSLog(@"联动股票代码：%@,联动代码最新价：%@,AH溢价率：%@,联动代码昨收价：%@,联动代码涨跌幅：%@,HA溢价率：%@",response.linkageCode,response.lastPrice,response.premiumRate,response.preClosePrice,response.changeRate,response.premiumRateHA);
//            NSLog(@"%@",response);
//
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"AH联动请求错误，错误信息是：%@",resp.message);
//        }
//    }];

    //练习:AH列表
//    MAHQuoteListRequest *request = [[MAHQuoteListRequest alloc] init];
//    request.pageIndex = 0;
//      request.pageSize = 2000;
//      request.field = MAHQuoteListFieldChangeRateA;
//      request.ascending = NO;
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MAHQuoteListResponse *response = (MAHQuoteListResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////            NSLog(@"1=====:%@",response);
//
//            NSArray *items = response.ahItems;
//            for(int i = 0;i<items.count;i++){
//                MAHQuoteItem *item = items[i];
//                NSLog(@"联动名称:%@,A股代码:%@,A股最新价:%@,A股昨收:%@,A股涨跌比率:%@,A股交易时间:%@,H股代码:%@,H股最新价:%@,H股昨收:%@,H股涨跌比率:%@,H股交易时间:%@,AH溢价率:%@,HA溢价率:%@,H股代码名称:%@",item.name,item.codeA,item.lastPriceA,item.preClosePriceA,item.changeRateA,item.datetimeA,item.codeH,item.lastPriceH,item.preClosePriceH,item.changeRateH,item.datetimeH,item.premiumRate,item.premiumRateHA,item.nameH);
////                NSLog(@"%@,%@",item.codeA,item.name);
////                NSLog(@"%@,%@",item.codeA,item.codeH);
//            }
//
//
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"AH列表请求错误，错误信息是：%@",resp.message);
//        }
//    }];

    
    
    //练习:AB列表
//                MABQuoteListRequest *request = [[MABQuoteListRequest alloc] init];
//                    request.pageIndex = 0;
//                      request.pageSize = 2000;
//                      request.field = MABQuoteListFieldChangeRateA;
//                      request.ascending = NO;
//                    //发送请求
//                    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//                        if (resp.status == MResponseStatusSuccess) {
//                            //应答无误，处理数据更新画面
//                            MABQuoteListResponse *response = (MABQuoteListResponse *)resp;
//                            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//                //            NSLog(@"1=====:%@",response);
//
//                            NSArray *items = response.items;
//                            for(int i = 0;i<items.count;i++){
//                                MABLinkItem *item = items[i];
//                                NSLog(@"A股代码:%@,A股名称:%@,A股类别:%@,A股最新价:%@,A股涨幅:%@,B股代码:%@,B股名称:%@,B股类别:%@,B股最新价:%@,B股涨幅:%@,AB溢价率:%@,BA溢价率:%@",item.codeA,item.nameA,item.subtypeA,item.lastPriceA,item.changeRateA,item.codeB,item.nameB,item.subtypeB,item.lastPriceB,item.changeRateB,item.premiumRateAB,item.premiumRateBA);
////                                NSLog(@"%@,%@",item.codeA,item.codeB);
//                            }
//
//
//                        } else {
//                            //应答错误，显示错误信息
//                            NSLog(@"AH列表请求错误，错误信息是：%@",resp.message);
//                        }
//                    }];
//    //    练习:AB联动
//                    MABQuoteRequet *request = [[MABQuoteRequet alloc] init];
//                        request.code = @"600604.sh";
//    //                      request.pageSize = 200;
//    //                      request.field = MABQuoteListFieldChangeRateA;
//    //                      request.ascending = NO;
//                        //发送请求
//                        [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//                            if (resp.status == MResponseStatusSuccess) {
//                                //应答无误，处理数据更新画面
//                                MABQuoteResponse *response = (MABQuoteResponse *)resp;
//                                NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                                data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//                                NSLog(@"1=====:%@",response);
//
//    //                            NSArray *items = response.items;
//    //                            for(int i = 0;i<items.count;i++){
//    //                                MABLinkItem *item = items[i];
//                                    NSLog(@"A股代码:%@,A股名称:%@,A股类别:%@,A股最新价:%@,A股涨幅:%@,B股代码:%@,B股名称:%@,B股类别:%@,B股最新价:%@,B股涨幅:%@,AB溢价率:%@,BA溢价率:%@",item.codeA,item.nameA,item.subtypeA,item.lastPriceA,item.changeRateA,item.codeB,item.nameB,item.subtypeB,item.lastPriceB,item.changeRateB,item.premiumRateAB,item.premiumRateBA);
//                                ////                                NSLog(@"%@,%@",item.codeA,item.codeB);
//                                    NSLog(@"%@,",response);
//    //                            }
//
//
//                            } else {
//                                //应答错误，显示错误信息
//                                NSLog(@"AH列表请求错误，错误信息是：%@",resp.message);
//                            }
//                        }];
//
//    ·
    
    //练习:沪伦通联动
//    MDRLinkRequest *request = [[MDRLinkRequest alloc] init];
//    request.code = @"651019.uk"; //填入股票代码
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MDRLinkResponse *response = (MDRLinkResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            //NSLog(@"1=====:%@",response);
////            NSLog(@"%@,%@,%@,%@,%@",response.linkageCode,response.lastPrice,response.premiumRate,response.preClosePrice,response.changeRate);
//            NSLog(@"%@",response);
//
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"沪伦通联动请求错误，错误信息是：%@",resp.message);
//        }
//    }];
//
    //练习:沪伦通列表
//    MDRQuoteListRequest *request = [[MDRQuoteListRequest alloc] init];
//    request.code = @"gdr";
//    request.pageIndex = 0;
//    request.pageSize = 100;
//    request.ascending = NO;
//    request.field = MDRQuoteListFieldChangeRate;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MDRQuoteListResponse *response = (MDRQuoteListResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//           data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////            NSLog(@"1=====:%@",response);
//            NSArray *item = response.items;
//            NSLog(@"%ld",item.count);
//            for (int i=0; i<item.count; i++) {
//                MDRQuoteItem *items = item[i];
//                NSLog(@"%@",items);
////                NSLog(@"%@,%@,%@,%@,%@",response.linkageCode,response.lastPrice,response.premiumRate,response.preClosePrice,response.changeRate);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"沪伦通列表请求错误，错误信息是：%@",resp.message);
//        }
//    }];
//////
//        NSArray *codeArr = @[@"80737.hk",@"08483.hk",@"20521.hk",@"68086.hk",@"HSI.hk",@"01365.hk",@"03097.hk",@"00142.hk",@"00038.hk",@"01185.hk",@"02018.hk",@"01799.hk",@"02371.hk"];
//        NSArray *subtypeArr = @[@"1010",@"1010",@"1600",@"1500",@"1400",@"1010",@"1100",@"1010",@"1010",@"1010",@"1010",@"1010",@"1010"];
//    NSArray *codeArr = @[@"08055.hk",@"68086.hk",@"01365.hk",@"02371.hk"];
//    NSArray *subtypeArr = @[@"1010",@"1500",@"1010",@"1010"];
//
//
//        for (int iii = 0;iii<codeArr.count;iii++){
////    练习:历史分时走势数据
//    MHistoryChartRequest *request = [[MHistoryChartRequest alloc] init];
//    request.code = @"430047.bz";//填入股票代码
//    request.date = @"20200601";
//    request.subtype=  @"1001";
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MHistoryChartResponse *response = (MHistoryChartResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//           data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////          NSLog(@"1----:%@",response);
//            NSArray *item = response.OHLCItems;
//            NSLog(@"%@--%@--%zd",request.code,request.date,item.count);
//            for (int i=0; i<item.count; i++) {
//                MOHLCItem *items = item[i];
////                NSLog(@"%@",items);
////
//                NSLog(@"时间：%@,成交量：%@,开盘价：%@,参考价：%@,收盘价：%@",items.datetime,items.tradeVolume,items.openPrice,items.referencePrice,items.closePrice);
////                NSLog(@"%@",items.datetime);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"历史分时走势请求错误，错误信息是：%@",resp.message);
//        }
//    }];


    //练习:UK市场行情
//    MUKQuoteRequest *request = [[MUKQuoteRequest alloc] init];
//       request.code = @"CPIC.uk"; //填入股票代码
//       //发送请求
//       [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//           if (resp.status == MResponseStatusSuccess) {
//               //应答无误，处理数据更新画面
//               MUKQuoteResponse *response = (MUKQuoteResponse *)resp;
//               NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//               data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//               //NSLog(@"站点信息：%@",request.ip);
//               MStockItem *item = response.stockItems;
//               NSLog(@"%@",item);
//           } else {
//               //应答错误，显示错误信息
//               NSLog(@"回传代码：%ld",resp.status);
//               //NSLog(@"错误站点信息：%@",request.ip);
//               NSLog(@"UK市场行情请求错误，错误信息是：%@",resp.message);
//           }
//       }];

    //练习:指数成分股及沪深市场涨跌平家数
//    MIndexUpdownsRequest *request = [[MIndexUpdownsRequest alloc] init];
//    request.code = @"SHSZ";
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MIndexUpdownsResponse *response = (MIndexUpdownsResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1=====:%@",response);
//            NSLog(@"站点信息:%@",request.ip);
//            NSLog(@"%@",dic);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"指数成分股及沪深市场涨跌平家数请求错误，错误信息是：%@",resp.message);
//        }
//    }];
//
    //练习:沪深当日涨跌统计数据
//    MMarketUpdownsRequest *request = [[MMarketUpdownsRequest alloc] init];
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MMarketUpdownsResponse *response = (MMarketUpdownsResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1=====:%@",response);
//            NSLog(@"站点信息:%@",request.ip);
//            NSLog(@"%@",dic);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"沪深当日涨跌统计数据请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
////    当日或30日复盘涨跌
//    MCompoundUpdownsRequest *request = [[MCompoundUpdownsRequest alloc] init];
//    request.code = @"sh";
//    request.type = MCompoundUpdownsTypeThirtyDays;
//    request.time = @"202105280930";
//
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MCompoundUpdownsResponse *response = (MCompoundUpdownsResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//           data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"站点信息:%@",request.ip);
//            NSArray *items = response.items;
//            NSLog(@"%ld",items.count);
//            for (int i=0; i<items.count; i++) {
//                MUpdownsItem *item = items[i];
//                NSLog(@"计算时间%@,上涨家数%@,下跌家数%@,平盘家数%@,停牌家数%@,涨停家数%@,跌停家数%@,一字涨停家数%@,自然涨停家数%@,五日平均涨停家数 %@",item.dateTime,item.riseCount,item.fallCount,item.flatCount,item.stopCount,item.riseLimitCount,item.fallLimitCount,item.oneRiseLimitCount,item.natureRiseFallCount,item.fiveAverageLimitCount);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"沪深当日涨跌统计数据请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
//    //练习:分时走势指标数据
//    MChartIndexRequest *request = [[MChartIndexRequest alloc] init];
//    request.code = @"300237.sz"; //填入股票代码
//    request.type =  MChartIndexTypeDDX |  MChartIndexTypeDDY | MChartIndexTypeDDZ |  MChartIndexTypeBBD | MChartIndexTypeRatioBS | MChartIndexTypeLargeMoneyInflow | MChartIndexTypeBigMoneyInflow | MChartIndexTypeMidMoneyInflow | MChartIndexTypeSmallMoneyInflow | MChartIndexTypeLargeTradeNum | MChartIndexTypeBigTradeNum | MChartIndexTypeMidTradeNum | MChartIndexTypeSmallTradeNum | MChartIndexTypeBigNetVolume;
//    request.beginIndex = 0;
//    request.endIndex = 2000;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//                //应答无误，处理数据更新画面
//                MChartIndexResponse *response = (MChartIndexResponse *)resp;
//                NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//                NSLog(@"站点信息:%@",request.ip);
//                NSArray *items = response.OHLCItems;
//                NSLog(@"%lu",(unsigned long)items.count);
//                for (int i=0; i<items.count; i++) {
//                MOHLCItem *item = items[i];
//                NSLog(@"");
//                NSLog(@"datetime = %@",item.datetime);
//                NSLog(@"bbd = %@",item.bbd);
//                NSLog(@"ddz = %@",item.ddz);
//                NSLog(@"ddx = %@",item.ddx);
//                NSLog(@"ddy = %@",item.ddy);
//                NSLog(@"ratioBS = %@",item.ratioBS);
//                NSLog(@"largeMoneyInflow = %@",item.largeMoneyInflow);
//                NSLog(@"bigMoneyInflow = %@",item.bigMoneyInflow);
//                NSLog(@"midMoneyInflow = %@",item.midMoneyInflow);
//                NSLog(@"smallMoneyInflow = %@",item.smallMoneyInflow);
//
//                NSLog(@"largeTradeNum = %@",item.largeTradeNum);
//                NSLog(@"bigTradeNum = %@",item.bigTradeNum);
//                NSLog(@"midTradeNum = %@",item.midTradeNum);
//                NSLog(@"smallTradeNum = %@",item.smallTradeNum);
//
//                NSLog(@"bigNetVolume = %@",item.bigNetVolume);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"分时走势指标数据请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
//    历史增值数据
    MOHLCIndexRequest *request = [[MOHLCIndexRequest alloc] init];
    request.code = @"600000.sh";
    request.type = MChartIndexTypeBigNetVolume;
    request.period = MOHLCPeriodMin1;
//    request.date = @"20211121094000";
//    request.requestType = MRequestTypeOlder;
//    request.count = 241;

    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
        if (resp.status == MResponseStatusSuccess) {
            //应答无误，处理数据更新画面
            MOHLCIndexResponse *response = (MOHLCIndexResponse *)resp;
            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
           data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
            NSLog(@"站点信息:%@",request.ip);
            NSArray *items = response.OHLCItems;
            NSLog(@"%lu",(unsigned long)items.count);
            for (int i=0; i<items.count; i++) {
                MOHLCItem *item = items[i];
                NSLog(@"");
                NSLog(@"datetime = %@",item.datetime);
//                NSLog(@"bbd = %@",item.bbd);
//                NSLog(@"ddz = %@",item.ddz);
//                NSLog(@"ddx = %@",item.ddx);
//                NSLog(@"ddy = %@",item.ddy);
//                NSLog(@"ratioBS = %@",item.ratioBS);
//                NSLog(@"largeMoneyInflow = %@",item.largeMoneyInflow);
//                NSLog(@"bigMoneyInflow = %@",item.bigMoneyInflow);
//                NSLog(@"midMoneyInflow = %@",item.midMoneyInflow);
//                NSLog(@"smallMoneyInflow = %@",item.smallMoneyInflow);

//                NSLog(@"largeTradeNum = %@",item.largeTradeNum);
//                NSLog(@"bigTradeNum = %@",item.bigTradeNum);
//                NSLog(@"midTradeNum = %@",item.midTradeNum);
//                NSLog(@"smallTradeNum = %@",item.smallTradeNum);
//
                NSLog(@"bigNetVolume = %@",item.bigNetVolume);
//                NSLog(@"mainforceMoneyInflow = %@",item.mainforceMoneyInflow);
//                NSLog(@"mainforceMoneyOutflow = %@",item.mainforceMoneyOutflow);
            }
        } else {
            //应答错误，显示错误信息
            NSLog(@"沪深当日涨跌统计数据请求错误，错误信息是：%@",resp.message);
        }
    }];

//    //练习:板块排行
//    MSectionSortingRequest *request = [[MSectionSortingRequest alloc] init];
//    request.code = @"Notion_szyp"; //填入板块代码
////    request.pageIndex = 0;//起始页
////    request.pageSize = 10;
//    request.beginIndex = 0;
//    request.endIndex = 99;
//    request.ascending = NO;//是否升序
//    request.field = MSectionSortingFieldEntrustSellVolume;//填入排序栏位
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MSectionSortingResponse *response = (MSectionSortingResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////            NSLog(@"1----:%@",response);
//            NSLog(@"站点信息:%@",resp.request.ip);
//            NSArray *item = response.sectionSortingItems;
//            NSLog(@"%ld",item.count);
//            for (int i=0; i<item.count; i++) {
//                MSectionSortingItem *items = item[i];
////                NSLog(@"%@,板块名称%@,,排序字段%@,领涨股代码%@,领涨名称%@,领涨股次类别%@",items.ID,items.name,items.entrustSellVolume,items.stockID,items.stockName,items.stockSubtype);
//            NSLog(@"%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@,%@",items.ID,items.name,items.lastPrice,items.openPrice,items.highPrice,items.lowPrice,items.preClosePrice,items.change,items.changeRate,items.changeRate5,items.changeRate10,items.amount,items.volume,items.nowVolume,items.weightedChange,items.averageChange,items.flowValue,items.totalValue,items.orderRatio,items.entrustDiff,items.turnoverRate,items.amplitudeRate,items.riseRate,items.advanceAndDeclineCount,items.limitUpCount,items.limitDownCount,items.capitalInflow,items.capitalOutflow,items.netCapitalInflow,items.netCapitalInflow5,items.netCapitalInflow10,items.stockID,items.stockChange,items.stockChangeRate);
////                NSLog(@"名：%@,  第%u条数据",items.name,i+1);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"板块排行请求错误，错误信息是：%@",resp.message);
//        }
//    }];

////        //板块指数行情快照
//    MPlateIndexQuoteRequest *request = [[MPlateIndexQuoteRequest alloc] init];
//    request.code = @"A20001.bk"; //填入股票代码
//    //request.plateIndexFields = @[@"bigVolumeB",@"blockChg"];
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MPlateIndexQuoteResponse *response = (MPlateIndexQuoteResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"站点信息:%@",resp.request.ip);
//            NSArray *items = response.plateIndexItems;
//            MPlateIndexItem *item = items[0];
//            NSLog(@"%@",item);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"错误站点信息:%@",resp.request.ip);
//            NSLog(@"板块指数行情快照请求错误，错误信息是：%@",resp.message);
//        }
//    }];
////
    //练习:板块行情请求类
//    MSectionQuoteRequest *request = [[MSectionQuoteRequest alloc] init];
//    request.code = @"600000.sh"; //填入板块代码
//    request.type = @"notion";
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MSectionQuoteResponse *response = (MSectionQuoteResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSArray *item = response.sectionQuoteItems;
//            NSLog(@"%lu",(unsigned long)item.count);
//            for (int  i=0;i<item.count; i++) {
//                MSectionSortingItem *items = item[i];
////                NSLog(@"%@,%@,%@,%@,%@,%@,%@",items.ID,items.name,items.lastPrice,items.stockID,items.stockName,items.stockLastPrice,items.type);
////                NSLog(@"主力净流入：%@，板块代码：%@",items.netCapitalInflow,items.ID);
//                NSLog(@"%@",items);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"板块行情请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    
//    int temp1[] = {0,1,2,7,8,9,10,11,12,13,14,15,19,20,21,24,25,26,27,28,29,30,31,32,37,38,42,53,54,57,58,86,87,88,89,-19,-20,-21,-22,-34,-35,-36,-37,-38,-39,-40,-41,-42,-47,-48,-58,-59,-60,-61,-62,-63};
//    NSArray *temp2 = @[@"status",@"ID",@"name",@"lastPrice",@"highPrice",@"lowPrice",@"openPrice",@"preClosePrice",@"changeRate",@"volume",@"nowVolume",@"turnoverRate",@"change",@"amount",@"volumeRatio",@"buyVolume",@"sellVolume",@"totalValue",@"flowValue",@"netAsset",@"PE",@"ROE",@"capitalization",@"circulatingShare",@"amplitudeRate",@"receipts",@"SPE",@"orderRatio",@"entrustDiff",@"DRCurrentShare",@"DRPreviousClosingShare",@"monthChangeRate",@"yearChangeRate",@"nMonthChangeRate",@"nYearChangeRate",@"ultraLargeNetInflow",@"largeNetInflow",@"mediumNetInflow",@"smallNetInflow",@"bbd",@"bbd5",@"bbd10",@"ddx",@"ddx5",@"ddx10",@"ddy",@"ddy5",@"ddy10",@"netCapitalInflow",@"fiveMinRise",@"netInflow5",@"netInflow10",@"netInflow20",@"netInflowRate5",@"netInflowRate10",@"netInflowRate20"];
//    NSArray *temp3 = @[@"HSCCI.hk",@"HSCEI.hk",@"HSC.hk",@"HSI.hk",@"HSP.hk",@"HSF.hk",@"HSU.hk"
//];
//    for (int iii = 0;iii<temp3.count;iii++){
//    for (int io = 0;io<temp2.count;io++){
////    练习:
    ///排行
////    NSArray *orry = @[@"SH1001",@"SH1002",@"SH1520",@"SH1540",@"SH1005",@"SH1006",@"SH1100",@"SH1110",@"SH1120",@"SH1130",@"SH1300",@"SH1311",@"SH1312",@"SH1313",@"SH1314",@"SZ1001",@"SZ1002",@"SZ1003",@"SZ1004",@"SZ10041",@"SZ10042",@"SZ1005",@"SZ1100",@"SZ1110",@"SZ1120",@"SZ1140",@"SZ1300",@"SZ1311",@"SZ1313",@"SZ1314",@"SHS",@"SZS"];
////        for (int i=0;i<orry.count;i++){
//    MCategorySortingRequest *request =[[MCategorySortingRequest alloc] init];
//    request.code = temp3[iii]; //分类代码
//    request.pageIndex = 0; //起始页码
//    request.pageSize = 10000;//每页多少条
////    request.beginIndex = 1;
////    request.endIndex = 50;
//    request.ascending = YES;//是否升序
//    request.field = temp1[io]; // 排序栏位
////    request.CFFSortingField = MCategoryCFFSortingFieldID; // 中金所排序栏位
//    request.includeSuspension = YES;//是否包含停牌股
////    request.stockFields = @[@"name",@"sellVolume"];
//    request.stockFields = nil;//快照自定义
//    request.addValueFields = @[@"-1"];//增值指标自定义
////    request.addValueFields = nil;//增值指标自定义
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        NSString *string;
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//
//            MCategorySortingResponse *response = (MCategorySortingResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSArray *items = response.stockItems;
//            NSLog(@"%@",request.ip);
//            string = [items componentsJoinedByString:@","];
////            NSLog(@"%@",response);
////            NSLog(@"有用信息- %@-%lu",request.code,(unsigned long)item.count);
////            NSLog(@"排序字段zong:%@",temp2[io]);
//            for (int i=0; i<items.count; i++) {
//                MStockItem *item = items[i];
////                NSLog(@"%@,%@,%@,%lu,%@,%@,%@,%@,%@,%@,%ld",items.ID,items.name,items.amount,(unsigned long)items.changeState,items.highPrice,items.lastPrice,items.totalValue,items.flowValue,items.PE,items.SPE,(long)items.status);
////                NSLog(@"我是一个粉刷匠：%@,  粉刷本领强：%@,  已经刷完%d面墙，刷呀刷的棒",items.name,items.ID,i+1);
//                NSString *str = @"jj";
//                if (item.changeState == 1){
//                    str = @"+";
//                }else if (item.changeState == 2){
//                    str = @"-";
//                }
//                NSLog(@"*有用信息- %@ 排序字段: %@: %@ %@",temp3[iii],temp2[io],str,[item valueForKey:temp2[io]]);
////                NSLog(@"%lu %@",(unsigned long)items.changeState,items.changeRate);
////                NSLog(@"%@ // %@",request.ip,items.addValueItem.ultraLargeNetInflow);
////                [_adiccc setValue:[NSString stringWithFormat:@"%@",item.addValueItem] forKey:[NSString stringWithFormat:@"%d",i]];
//            }
//            NSLog(@"*有用信息-");
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"回传代码：%ld,错误参数：%@",(long)resp.status,request.code);
//          //NSLog(@"错误站点信息:%@",resp.request.ip);
//            NSLog(@"分类排行请求错误，错误信息是：%@",resp.message);
//        }
////        UILabel *label = [[UILabel alloc] init];
////        label.frame = self.view.bounds;
////        label.backgroundColor = [UIColor greenColor];
////        label.textColor = [UIColor blueColor];
////        label.text = string;
////        label.numberOfLines = 0;
////        [self.view addSubview:label];
//    }];
//    }
//    }
    
    
////    练习:分类排行
//    MCategorySortingRequest *request =[[MCategorySortingRequest alloc] init];
//    request.code = @"BZ1001"; //分类代码
//    request.pageIndex = 0; //起始页码
//    request.pageSize = 5000;//每页多少条
////    request.beginIndex = 1;
////    request.endIndex = 50;
////    request.ascending = YES;//升序
//    request.ascending = NO;//倒序
//    request.field = MCategorySortingFieldMonthChangeRate; // 排序栏位
////    request.CFFSortingField = MCategoryCFFSortingFieldID; // 中金所排序栏位
//    request.includeSuspension = YES;//是否包含停牌股
////    request.stockFields = @[@"name",@"sellVolume"];
//    request.stockFields = NULL;//快照自定义
//    request.addValueFields = @[@"-1"];//增值指标自定义
////    request.addValueFields = @[@"fiveMinRise",@"ultraLargeNetInflow"];//增值指标自定义
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        NSString *string;
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//
//            MCategorySortingResponse *response = (MCategorySortingResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSArray *item = response.stockItems;
//            string = [item componentsJoinedByString:@","];
//            NSLog(@"%@",response);
////            NSLog(@"%d",item.count);
//            for (int i=0; i<item.count; i++) {
//                MStockItem *items = item[i];
//                NSLog(@"买数量单位: %@,卖数量单位: %@,上市日期: %@,股票代码: %@,股票名称: %@",items.buyQtyUnit,items.sellQtyUnit,items.listingDate,items.ID,items.name);
//
//
////                NSLog(@"%@,%@,%@,%lu,%@,%@,%@,%@,%@,%@,%ld",items.ID,items.name,items.amount,(unsigned long)items.changeState,items.highPrice,items.lastPrice,items.totalValue,items.flowValue,items.PE,items.SPE,(long)items.status);
////                NSLog(@"我是一个粉刷匠：%@,  粉刷本领强：%@,  已经刷完%d面墙，刷呀刷的棒",items.name,items.ID,i+1);
////
////                NSLog(@"市净率%@,最新价%@,净资产%@,%@",items.ROE,items.lastPrice,items.netAsset,items.code);
////                NSLog(@"市净率%@,最新价%@,今结%@,%@",items.ROE,items.lastPrice,items.settlement,items.code);
//////                NSLog(@"股票代码%@,买一量%@,卖一量%@,上市日期%@",items.code,items.buyVolume1,items.sellVolume1,items.listingDate);
////                NSLog(@"股票代码：%@,5日涨跌幅：%@,10日涨跌幅：%@,20日涨跌幅：%@,5日换手率：%@,10日换手率：%@,20日换手率：%@",items.ID,items.changeRate5,items.changeRate10,items.changeRate20,items.turnoverRate5,items.turnoverRate10,items.turnoverRate20);
//
////                NSLog(@"%@,%@,%@,%@z ",items.ID,items.buyVolume,items.sellActionRange,items.buyActionRange);
//////                  NSLog(@"\nbuyActionRange：%@,\nsellActionRange：%@,",items.buyActionRange,items.sellActionRange);
////                NSLog(@"%@ // %@,股票代码: %@",request.ip,items.addValueItem.bigMoneyNetInflow,items.ID);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"回传代码：%ld",(long)resp.status);
//          //NSLog(@"错误站点信息:%@",resp.request.ip);
//            NSLog(@"分类排行请求错误，错误信息是：%@",resp.message);
//        }
//        UITextView *label = [[UITextView alloc] init];
//        label.frame = self.view.bounds;
//        label.backgroundColor = [UIColor greenColor];
//        label.textColor = [UIColor blueColor];
//        label.text = string;
//        label.font = [UIFont systemFontOfSize:17];
//        [self.view addSubview:label];
//    }];
////////
    

////      //集合竞价走势数据
//    MBidChartRequest *request = [[MBidChartRequest alloc] init];
//    request.code = @"430047.bz"; //填入股票代码
//    request.subtype= @"1001";
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MBidChartResponse *response = (MBidChartResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////            NSLog(@"%@",response);
//            NSArray *item = response.bidItems;
//            NSLog(@"%lu",item.count);
//            for (int i=0; i<item.count; i++) {
//                MBidItem *items = item[i];
//                NSLog(@"时间%@,最新价%@,参考价%@,买1量%@,买2量%@,卖1量%@,卖2量%@",items.datetime,items.lastPrice,items.referencePrice,items.buyVolume1,items.buyVolume2,items.sellVolume1,items.sellVolume2);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"走势数据请求错误，错误信息是：%@",resp.message);
//        }
//    }];

////    练习:走势数据
//    MChartRequest *request = [[MChartRequest alloc] init];
//    request.code = @"430047.bz"; //填入股票代码
//    request.subtype= @"1001";
//
//    request.chartType = MChartTypeFiveDays;//走势类别
////        request.returnAFData= NO;//是否返回盘后交易数据
////
//
//    //    发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MChartResponse *response = (MChartResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSArray *item = response.OHLCItems;
//            NSLog(@"%lu",(unsigned long)item.count);
//            NSLog(@"%@",item);
//            for (int i=0; i<item.count; i++) {
//                MOHLCItem *items = item[i];
//                NSLog(@"交易时间：%@,昨收价：%@,成交量：%@,均价：%@,量比：%@",items.datetime,items.closePrice,items.tradeVolume,items.averagePrice,items.volumeRatio);
////                NSLog(@"%@",items);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"走势数据请求错误，错误信息是：%@",resp.message);
//        }
//    }];

//练习:走势叠加
//    MChartRequest *request = [[MChartRequest alloc] init];
//    request.code = @"832089.bz"; //填入股票代码
//    request.subtype= @"1001";
//    request.superpositionCode = @"688001.sh";//叠加项
//    request.superpositionSubtype = @"1006";
//    request.chartType = MChartTypeFiveDays;//走势类别
//        request.returnAFData= NO;//是否返回盘后交易数据
////
//
//    //    发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MChartResponse *response = (MChartResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//           data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSArray *item = response.OHLCItems;
//            NSArray *item1 = response.superpositionResponse.OHLCItems;
//            NSLog(@"SHULIANG: %lu",(unsigned long)item1.count);
////            NSLog(@"%@",item);
//            NSLog(@"海燕·1-------------");
////            NSLog(@"%@",item1);
//            for (int i=0; i<item1.count; i++) {
//                MOHLCItem *items = item1[i];
//                NSLog(@"%@",items);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"走势数据请求错误，错误信息是：%@",resp.message);
//        }
//    }];

////    盘后走势数据
//    MAfterHoursChartRequest *request = [[MAfterHoursChartRequest alloc] init];
//    request.code = @"204001.sh"; //填入股票代码
//    request.subtype= @"1300";
//
//
////    发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MAfterHoursChartResponse *response = (MAfterHoursChartResponse *)resp;
////            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
////            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"%@",response);
//            NSArray *item = response.OHLCItems;
//            int i= 0;
//            for (i=0; i<item.count; i++) {
//                MOHLCItem *items = item[i];
//                NSLog(@"时间%@,收盘价%@,交易量%@,参考价%@,均价%@",items.datetime,items.closePrice,items.tradeVolume,items.referencePrice,items.averagePrice);
////                NSLog(@"%@",items);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"走势数据请求错误，错误信息是：%@",resp.message);
//        }
//    }];



////    练习:K线数据
//    MOHLCRequest *request = [[MOHLCRequest alloc] init];
//    request.code = @"ag2110.shfe"; //填入股票代码
//    request.subtype= @"futureag";
//    request.period = MOHLCPeriodMin5; //K线周期
//    request.priceAdjustedMode = MOHLCPriceAdjustedModeNone; //复权模式
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MOHLCResponse *response = (MOHLCResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////            NSLog(@"1----:%@",response);
//            NSArray *item = response.OHLCItems;
//            NSLog(@"%ld",item.count);
//            for (int i=0; i<item.count; i++) {
//                MOHLCItem *items = item[i];
////                NSLog(@"%@,%@,%@",items.datetime,items.tradeVolume,items.amount);
////                NSLog(@"%@,%@,%@,%@,%@,%@,%@,%@",items.datetime,items.openPrice,items.highPrice,items.lowPrice,items.closePrice,items.referencePrice,items.tradeVolume,items.amount);
//            NSLog(@"时间:%@,开盘价:%@,最高价:%@,最低价:%@,收盘价:%@,参考价:%@,成交量:%@,成交额:%@",items.datetime,items.openPrice,items.highPrice,items.lowPrice,items.closePrice,items.referencePrice,items.tradeVolume,items.amount);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"K线数据请求错误，错误信息是：%@",resp.message);
//        }
//    }];
//    NSArray *codeArr = @[@"80737.hk",@"08483.hk",@"20521.hk",@"68086.hk",@"HSI.hk",@"01365.hk",@"03097.hk",@"00142.hk",@"00038.hk",@"01185.hk",@"02018.hk",@"01799.hk",@"02371.hk"];
//    NSArray *subtypeArr = @[@"1010",@"1010",@"1600",@"1500",@"1400",@"1010",@"1100",@"1010",@"1010",@"1010",@"1010",@"1010",@"1010"];
//    int periodArr[] = {0,1,2,3,4,5,6,7,8,9};
//    NSArray *dateArr = @[@"20201201",@"20201201",@"20201201",@"20201201150000",@"20201201150000",@"20201201150000",@"20201201150000",@"20201201150000",@"20201201150000",@"20201201"];
//
//    for (int iii = 0;iii<codeArr.count;iii++){
//        for (int jjj = 0;jjj<10;jjj++){
//
//    //练习:历史K线数据
//    MOHLCRequestV2 *request = [[MOHLCRequestV2 alloc] init];
//    request.code = codeArr[iii]; //填入股票代码
//    request.subtype= subtypeArr[iii];
//    request.period =periodArr[jjj]; //K线周期
//    request.count = 300;
//    request.date = dateArr[jjj];
//    request.requestType = MRequestTypeOlder; //按日期获取规则
//    request.priceAdjustedMode = MOHLCPriceAdjustedModeNone; //复权模式
////    NSLog(@"股票代码：%@---%@---%d---%@",codeArr[iii],subtypeArr[iii],periodArr[jjj],dateArr[jjj]);
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MOHLCResponse *response = (MOHLCResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////            NSLog(@"复权信息:%@",response.FQItems);
//            NSArray *item = response.OHLCItems;
//            NSLog(@"股票代码：%@---%@---%lu---%@---%zd",codeArr[iii],subtypeArr[iii],(unsigned long)request.period,dateArr[jjj],item.count);
//            for (int i=0; i<item.count; i++) {
//                MOHLCItem *items = item[i];
////        NSLog(@"第%d条数据，时间：%@,开盘价：%@,最高价：%@,最低价：%@,收盘价：%@,基金净值：%@,\n 参考价:%@,成交量:%@,成交额:%@,均价:%@,盘后成交量:%@,盘后成交额:%@",i,items.datetime,items.openPrice,items.highPrice,items.lowPrice,items.closePrice,items.IOPV,items.referencePrice,items.tradeVolume,items.amount,items.averagePrice,items.afterHoursVolume,items.afterHoursAmount);
////                NSLog(@"%d  时间：%@,开盘价：%@,最高价：%@,最低价：%@,收盘价：%@,基金净值：%@",i,items.datetime,items.openPrice,items.highPrice,items.lowPrice,items.closePrice,items.IOPV);
////                NSLog(@"站点：%@//:%d //:%@",request.ip,i,items.datetime);
//                NSLog(@"%@",items.datetime);
//                }
//
////            NSArray *arr= response.FQItems;
////            NSLog(@"%@",arr);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"历史K线数据请求错误，错误信息是：%@",resp.message);
//        }
//    }];
//
//
//
//        }
//    }
//
//    //练习:历史K线数据
//        MOHLCRequestV2 *request = [[MOHLCRequestV2 alloc] init];
//        request.code = @"09616.hk"; //填入股票代码
//        request.subtype= @"1010";
//        request.period = MOHLCPeriodMin1; //K线周期
//        request.count = 300;
//        request.date = @"x c";
//        request.requestType = MTimeTickRequestTypeOlder; //按日期获取规则
////         request.param = "0,100,1";
//        request.priceAdjustedMode = MOHLCPriceAdjustedModeNone; //复权模式
//        //发送请求
//        [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//            if (resp.status == MResponseStatusSuccess) {
//                //应答无误，处理数据更新画面
//                MOHLCResponse *response = (MOHLCResponse *)resp;
//                NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//    //            NSLog(@"复权信息:%@",response.FQItems);
//                NSArray *item = response.OHLCItems;
//                for (int i=0; i<item.count; i++) {
//                    MOHLCItem *items = item[i];
//            NSLog(@"第%d条数据，时间：%@,开盘价：%@,最高价：%@,最低价：%@,收盘价：%@,\n 参考价:%@,成交量:%@,成交额:%@,均价:%@",i,items.datetime,items.openPrice,items.highPrice,items.lowPrice,items.closePrice,items.referencePrice,items.tradeVolume,items.amount,items.averagePrice);
////                    NSLog(@"第%d条数据，时间：%@,开盘价：%@,收盘价：%@,成交量:%@,成交额:%@",i,items.datetime,items.openPrice,items.closePrice,items.tradeVolume,items.amount);
//    //                NSLog(@"%d  时间：%@,开盘价：%@,最高价：%@,最低价：%@,收盘价：%@,基金净值：%@",i,items.datetime,items.openPrice,items.highPrice,items.lowPrice,items.closePrice,items.IOPV);
//    //                NSLog(@"站点：%@//:%d //:%@",request.ip,i,items.datetime);
////                    NSLog(@"%@",items);
//                    }
//
//    //            NSArray *arr= response.FQItems;
//    //            NSLog(@"%@",arr);
//            } else {
//                //应答错误，显示错误信息
//                NSLog(@"历史K线数据请求错误，错误信息是：%@",resp.message);
//            }
//        }];
//    //练习:历史K线数据除权息
//        MOHLCRequestV2 *request = [[MOHLCRequestV2 alloc] init];
//        request.code = @"831010.bz"; //填入股票代码
//        request.subtype= @"1001";
//        request.period = MOHLCPeriodYear; //K线周期
////        request.count = 5;
////        request.date = @"20201118093000";
////        request.requestType = MRequestTypeOlder; //按日期获取规则
////        request.priceAdjustedMode = MOHLCPriceAdjustedModeNone; //复权模式
//        //发送请求
//        [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//            if (resp.status == MResponseStatusSuccess) {
//                //应答无误，处理数据更新画面
//                MOHLCResponse *response = (MOHLCResponse *)resp;
//                NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//
////                NSLog(@"fquan信息:%@",response.FQItems);
//                NSArray *items = response.FQItems;
//                for (int i=0; i<items.count; i++) {
//                    MFQItem *item = items[i];
//                    NSLog(@"fquan信息:%@",item);
//
//
//
//                }
//                NSArray *circulatingShareItems = response.circulatingShareItems;
//                    for (int i=0; i<circulatingShareItems.count; i++) {
//
//                        MCirculatingShareItem *item = circulatingShareItems[i];
//                        NSLog(@"GB信息:%@",item);
//                    }
//
//
////
////            NSLog(@"第%d条数据，时间：%@,开盘价：%@,最高价：%@,最低价：%@,收盘价：%@,\n 参考价:%@,成交量:%@,成交额:%@,均价:%@",i,items.dateTime,items.increasePrice,items.allotmentPrice,items.bonusAmount,items.bonusProportion,items.increaseProportion,items.increaseVolume,items.allotmentProportion,items.dateTime,items.circulatingShare);
////                    NSLog(@"第%d条数据，时间：%@,开盘价：%@,收盘价：%@,成交量:%@,成交额:%@",i,items.datetime,items.openPrice,items.closePrice,items.tradeVolume,items.amount);
//    //                NSLog(@"%d  时间：%@,开盘价：%@,最高价：%@,最低价：%@,收盘价：%@,基金净值：%@",i,items.datetime,items.openPrice,items.highPrice,items.lowPrice,items.closePrice,items.IOPV);
//    //                NSLog(@"站点：%@//:%d //:%@",request.ip,i,items.datetime);
////                    NSLog(@"%@",items);
//
//
//    //            NSArray *arr= response.FQItems;
//    //            NSLog(@"%@",arr);
//                 } else {
//                //应答错误，显示错误信息
//                NSLog(@"历史K线数据请求错误，错误信息是：%@",resp.message);
//            }
//        }];

//    //练习:经纪席位
//    MBrokerSeatRequest *request = [[MBrokerSeatRequest alloc] init];
//    request.code = @"651021.sh";
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MBrokerSeatResponse *response = (MBrokerSeatResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
////            NSArray *item = response.buyBrokerSeatItems;
////            int i=0;
////            for (i=0; i<100; i++) {
////                MBrokerSeatItem *items = item[i];
////                NSLog(@"%@",items);
////            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"经纪席位请求错误，错误信息是：%@",resp.message);
//        }
//    }];

////    //练习:股票查询-本地搜索（下载分市场股票代码表）
//    UIAlertView *_alertView = [[UIAlertView alloc] initWithTitle:@"提 示" message:[NSString stringWithFormat:@"\n正在下载最新股票代码表 请稍候···"] delegate:nil cancelButtonTitle:@"返回" otherButtonTitles:nil];
//    [_alertView show];
//
//    [MApi downloadStockTableWithMarkets:@[@"sh",@"sz",@"csi"] completionHandler:^(NSError *error)  {
////        @"sh",@"sz",@"cff",@"bj",@"hk",@"hh",@"hz",@"czce",@"dce",@"ine",@"shfe",@"fe",@"gb",@"gi",@"uk",
//        if (!error) {
//            sleep(10);
//            [_alertView dismissWithClickedButtonIndex:1 animated:YES];//提示框消失
//            MSearchRequest *request = [[MSearchRequest alloc] init];
//            request.keyword = @"600003"; //设定关键字
//            request.categories = @[@"sh"];
//            request.searchLimit = 20000;
//            request.searchLocal = NO;
//            request.returnRenamed = NO;
//            request.returnDelisted = YES;
//
//            //发送请求
//            [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//                if (resp.status == MResponseStatusSuccess) {
//                    //应答无误，处理数据更新画面
//                    MSearchResponse *response = (MSearchResponse *)resp;
//                    NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                    self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////                    NSLog(@"%@",response);
//                    NSArray *item = response.resultItems;
//                    //NSString *cachesPaths = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];
//                    NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
//                    NSLog(@"documentsPath:%@",documentsPath);
//                    NSLog(@"%lu",(unsigned long)item.count);
//                    for (int i=0; i<item.count; i++) {
//                        MSearchResultItem * items = item[i];
////                        NSLog(@"%@",items);
//////                        NSLog(@"%@,%@,%@,%@,%@,%@",items.code,items.name,items.market,items.subtype,items.pinyin,items.subtype);
//                        NSLog(@"%@,%@,%@,次类别：%@,st:%@",items.stockID,items.name,items.market,items.subtype,items.subtypes);
//                    }
//                } else {
//                    //应答错误，显示错误信息
//                    NSLog(@"股票查询请求错误，错误信息是：%@",resp.message);
//                }
//            }];
//        }else{ _alertView.message=@"下载失败 点击返回";
//        }
//    }];

//    练习:查看分市场股票代码表
//    UIAlertView *_alertView = [[UIAlertView alloc] initWithTitle:@"提 示" message:[NSString stringWithFormat:@"\n正在下载最新股票代码表 请稍候···"] delegate:nil cancelButtonTitle:@"返回" otherButtonTitles:nil];
//    [_alertView show];
//    [MApi downloadStockTableWithMarkets:@[@"csi"] completionHandler:^(NSError *error)  {
//        if (!error) {
//            sleep(10);
//            [_alertView dismissWithClickedButtonIndex:1 animated:YES];//提示框消失
//            MStockTableRequest *request = [[MStockTableRequest alloc] init];
//            //发送请求
//            [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//                if (resp.status == MResponseStatusSuccess) {
//                    //应答无误，处理数据更新画面
//                    MStockTableResponse *response = (MStockTableResponse *)resp;
//                    NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                    self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////                    NSLog(@"1----:%@",response);
////                    NSString *cachesPaths = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];
////                    NSLog(@"cachesPaths:%@",cachesPaths);
//                    NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
//                    NSLog(@"documentsPath:%@",documentsPath);
//                    NSArray *item = response.resultItems;
//                    int i = 0;
//                    for (i=0; i<item.count; i++) {
//                    MSearchResultItem *items = item[i];
//                    NSLog(@"%@",items);
//                    }
//                } else {
//                    //应答错误，显示错误信息
//                    NSLog(@"股票查询请求错误，错误信息是：%@",resp.message);
//                }
//            }];
//        }else{ _alertView.message=@"下载失败 点击返回";
//        }
//    }];
//
    //练习:股票查询-网络搜索
//    MSearchRequest *request = [[MSearchRequest alloc] init];
//     request.keyword = @"00"; //设定关键字
////   request.categories = @[@"bj_01000"];
//    request.searchLocal = NO;
////    request.searchLimit = 1000000;
//    request.returnRenamed = YES;
//    request.returnDelisted = YES;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MSearchResponse *response = (MSearchResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            //NSLog(@"1----:%@",response);
//            NSArray *item = response.resultItems;
//            NSLog(@"%ld,%@",item.count,request.ip);
//            for (int i=0; i<item.count; i++) {
//                MSearchResultItem *items = item[i];
////                NSLog(@"%@,%@,%@,%@,%@,%@",items.code,items.name,items.market,items.subtype,items.pinyin,items.subtypes);
//                NSLog(@"%@",items);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"股票查询请求错误，错误信息是：%@",resp.message);
//        }
//    }];

        //练习:股票查询2-网络搜索。方正使用的
//        MSearchRequestV2 *request = [[MSearchRequestV2 alloc] init];
//        request.keyword = @"0000"; //设定关键字
//        request.searchLimit = 20000;
//          request.categories = @[@"SH1001"];
//
//        //发送请求
//        [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//            if (resp.status == MResponseStatusSuccess) {
//                //应答无误，处理数据更新画面
//                MSearchResponse *response = (MSearchResponse *)resp;
//                NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//                //NSLog(@"1----:%@",response);
//                NSArray *item = response.resultItems;
//                NSLog(@"%ld",item.count);
//                for (int i=0; i<item.count; i++) {
//                    MSearchResultItem *items = item[i];
////                    NSLog(@"%@,%@,%@,%@,%@",items.code,items.name,items.market,items.subtype,items.subtypes);
//                    NSLog(@"%@,%@,%@,%@",items.code,items.name,items.market,items.subtype);
////                    NSLog(@"%@",items);
//                }
//            } else {
//                //应答错误，显示错误信息
//                NSLog(@"股票查询请求错误，错误信息是：%@",resp.message);
//            }
//        }];
//
//////    练习:期权-标的行情
//    MUnderlyingStockRequest *request =[[MUnderlyingStockRequest alloc] init];
//    request.market =@"sh";//上海期权：sh，深圳期权：sz 多个市场期权用逗号分隔，如沪深期权：sh,sz
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MUnderlyingStockResponse *response = (MUnderlyingStockResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//           data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSArray *item = response.stockItems;
//            NSLog(@"%lu",(unsigned long)item.count);
//            for (int i=0; i<item.count; i++) {
//                MOptionItem *items = item[i];
//                NSLog(@"%@",items);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"期权-标的行情请求错误，错误信息是：%@",resp.message);
//        }
//    }];

//    //练习:期权-交割月列表
//    MExpireMonthRequest *request = [[MExpireMonthRequest alloc] init];
//    request.stockID = @"510050.sh";
////    request.isV2 = TRUE;
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MExpireMonthResponse *response = (MExpireMonthResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"期权-交割月列表请求错误，错误信息是：%@",resp.message);
//        }
//    }];

//    //练习:期权-商品行情
//    MOptionRequest *request =[[MOptionRequest alloc] init];
//    request.stockID = @"510300.sh";
//    request.pageIndex = 0;
//    request.optionType = MOptionTypeUnknown;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MOptionResponse *response = (MOptionResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            //NSLog(@"1=====:%@",response);
//            NSArray *item = response.optionItems;
//            for (int i=0; i<item.count; i++) {
//                MOptionItem *items = item[i];
////                NSLog(@"%@,%@,量比%@,均价%@,今结%@,外盘%@,内盘%@",items.ID,items.stockID,items.volumeRatio,items.averagePrice,items.setPrice,items.buyVolume,items.sellVolume);
//                NSLog(@"海燕%@",items);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"期权-商品行情请求错误，错误信息是：%@",resp.message);
//
//        }
//    }];
////
//    //练习:期权T型报价行情
//    MOptionTRequest *request = [[MOptionTRequest alloc] init];
//    request.stockID = @"510050.sh";
//    request.expireMonth = @"2108";
//
////    发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MOptionResponse *response = (MOptionResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//           data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSArray *item = response.optionItems;
//            NSLog(@"%lu",(unsigned long)item.count);
//            NSLog(@"%@", response);
//            for (int i=0; i<item.count; i++) {
//                MOptionItem *items = item[i];
//                NSString *ss;
//                if (items.isLimit==true) {
//                    ss=@"有";
//                }
//                else ss=@"无";
//                NSLog(@"啦啦啦%d：",i+1);
////                NSLog(@"cascasc%@",items);
//                NSLog(@"\n合约代码：%@\n标的证券代码：%@\n标的证券简称：%@\n标的证券类型：%@\n合约单位：%@\n期权行权价格：%@\n首个交易日：%@\n最后交易日：%@\n期权行权日：%@\n期权交割日：%@\n期权到期日：%@\n合约版号：%@\n前结算价：%@\n标的证券昨收：%@\n标的证券价格：%@\n有无涨跌限制：%@\n剩余天数：%@\n持仓量：%@\n隐含波动率：%@\nDelta：%@\nRho：%@\nTheta：%@\nGamma：%@\nVega：%@\n内在价值：%@\n时间价值：%@\n杠杆率：%@\n溢价率：%@\n虚实度：%@\n真实杠杆：%@\n理论价：%@\nID：%@\n",items.contractID,items.stockID,items.stockSymble,items.stockType,items.unit,items.exePrice,items.startDate,items.endDate,items.exeDate,items.deliDate,items.expDate,items.version,items.presetPrice,items.stockClose,items.stockLast,ss,items.remainDate,items.openInterest,items.impliedVolatility,items.delta,items.rho,items.theta,items.gamma,items.vega,items.inValue,items.timeValue,items.leverageRatio,items.premiumRate,items.virtualReality,items.leverage,items.theoreticalPrice,items.ID);
//            }
//        } else {
//
//            //应答错误，显示错误信息
//            NSLog(@"期权T型报价行情请求错误，错误信息是：%@",resp.message);
//        }
//    }];

//    //练习:分价量表
//    MPriceVolumeRequest *request = [[MPriceVolumeRequest alloc] init];
//    request.code = @"430047.bz";
//    request.subtype = @"1001";
//    request.param = @"0,300,-1";
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MPriceVolumeResponse *response = (MPriceVolumeResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSArray *item = response.items;
//
//            for (int i=0;i<item.count;i++) {
//                MPriceVolumeItem *items = item[i];
////                NSLog(@"%@,%@",items.price,items.volume);
//                NSLog(@"站点显示：%@",request.ip);
////                NSLog(@"最大价格%@", response.maxPrice);
////                NSLog(@"最小价格%@", response.minPrice);
//                NSLog(@"价%@,量%@", items.price, items.volume);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"分价量表请求错误，错误信息是：%@",resp.message);
//        }
//    }];
//
////    分量请求
//    MVolumeRequest *request = [[MVolumeRequest alloc] init];
//    request.code = @"204001.sh";
//    request.subtype = @"1311";
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MVolumeResponse *response = (MVolumeResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"站点：%@",request.ip);
////            NSLog(@"%@",response);
////            NSLog(@"分量表数组：%@",response.volumes);
////            NSLog(@"分量表买数组：%@",response.buyVolumes);
//            NSLog(@"分量表卖数组：%@,分量表数组：%@,分量表卖数组：%@",response.sellVolumes,response.volumes,response.buyVolumes);
//            for (int i = 0;i<response.sellVolumes.count;i++){
//                NSLog(@"%@",response.sellVolumes[i]);
//            }
//
//            for (int i = 0;i<response.volumes.count;i++){
//                NSLog(@"%@",response.volumes[i]);
//            }
//
//            for (int i = 0;i<response.buyVolumes.count;i++){
//                NSLog(@"%@",response.buyVolumes[i]);
//            }
//
//
////            for (int i=0;i<item.count;i++) {
////                MPriceVolumeItem *items = item[i];
////                NSLog(@"%@,%@",items.price,items.volume);
////            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"分价量表请求错误，错误信息是：%@",resp.message);
//        }
//    }];


////    练习:买卖队列
//    MOrderQuantityRequest *request = [[MOrderQuantityRequest alloc] init];
//    request.code = @"600000.sh";
//    request.subtype = @"1001";
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MOrderQuantityResponse *response = (MOrderQuantityResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////            NSLog(@"%@", response.buyItems);
//            NSArray *item = response.buyItems;
//            for (int i=0; i<item.count; i++) {
//                MOrderQuantityItem *items = item[i];
//                NSLog(@"%@",response);
//            }
////            NSArray *item1 = response.sellItems;
////            for (int i=0; i<item1.count; i++) {
////                MOrderQuantityItem *arr = item1[i];
////                NSLog(@"%@",arr);
////            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"买卖队列请求错误，错误信息是：%@",resp.message);
//        }
//    }];

////    练习:港股其他信息
//    MHKQuoteInfoRequest *request = [[MHKQuoteInfoRequest alloc] init];
//    request.code = @"00700.hk";
//    request.subtype = @"1010";
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//            if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MHKQuoteInfoResponse *response = (MHKQuoteInfoResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//           data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//        NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"港股其他信息请求错误，错误信息是：%@",resp.message);
//        }
//    }];

//    //练习:假日黑名单
//    MMarketHolidayRequest *request = [[MMarketHolidayRequest alloc] init];
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MMarketHolidayResponse *response = (MMarketHolidayResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"假日黑名单请求错误，错误信息是：%@",resp.message);
//        }
//    }];

////    练习:分时明细表。  L1分笔    /v2/tick
//
//    MTimeTickRequest *request = [[MTimeTickRequest alloc] init];
//    request.code = @"000001.sz";
//    request.subtype = @"1001";
////    request.index = @"8417005";
////    request.pageSize = 100;
////    request.type =  MTimeTickRequestTypeNewer; //最新N笔数据
////    request.param =@"0,100,1";
//    request.param =@"0,100,-1";
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MTimeTickResponse *response = (MTimeTickResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//          data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////            NSLog(@"1=====:%@",response);
//            NSLog(@"%@,%@",response.startIndex,response.endIndex);
//            NSArray *item = response.items;
////            NSLog(@"%@",response);
////            NSLog(@"-%@-",item);
//            NSLog(@"%lu",(unsigned long)item.count);
//            for (int i=0; i<item.count; i++) {
//                MTickItem *items = item[i];
//                NSLog(@"交易时间%@,成交价格%@,交易量%@,买卖方向%lu",items.time8,items.tradePrice,items.tradeVolume,(unsigned long)items.type);
////                NSLog(@"%@ %@",items.time8,items);
////                 NSLog(@"%@,%@,%@,%@",items.time8,items.tradePrice,items.tradeVolume,items.tradeVolume);
////                NSLog(@"%@",items);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"分时明细表请求错误，错误信息是：%@",resp.message);
//        }
//    }];

////     练习:分笔明细表
//    ML2TimeTickRequest *request = [[ML2TimeTickRequest alloc] init];
//    request.code = @"000001.sz";
//    request.subtype = @"1001";
//    request.index = @"0";
//    request.pageSize = 200;
//    request.type = MTimeTickRequestTypeRecent; //最新N笔数据
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            ML2TimeTickResponse *response = (ML2TimeTickResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"%@,%@",response.startIndex,response.endIndex);
//            NSArray *item = response.items;
//            NSLog(@"----%@",response);
//            NSLog(@"%lu",item.count);
//            for (int i=0; i<item.count; i++) {
//                MTimeTickItem *items = item[i];
//                NSLog(@"%@,%@,%@,%lu,%lu",items.time8,items.tradePrice,items.tradeVolume,items.type,items.CFFFlag);
////                NSLog(@"%@",items);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"分笔明细表请求错误，错误信息是：%@",resp.message);
//        }
//    }];

//    //练习:分笔对逐笔明细
//    MTimeTickDetailRequest *request = [[MTimeTickDetailRequest alloc] init];
//    request.code = @"IC2106.cff";
//    request.subtype = @"futureIC";
//    request.index = @"0";
//    request.pageSize = 20;
//    request.type = MTimeTickRequestTypeOlder;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MTimeTickDetailResponse *response = (MTimeTickDetailResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"%@,%@",response.startIndex,response.endIndex);
//            NSLog(@"分笔明细如下：");
//            NSArray *item = response.tickItems;
////            NSLog(@"%@",item);
//            for (int i=0; i<item.count; i++) {
//                MTickItem *items = item[i];
//                NSLog(@"%@,%@,%@,%lu",items.time8,items.tradePrice,items.tradeVolume,(unsigned long)items.type);
//            }
//            NSLog(@"逐笔明细如下：");
//            NSArray *Arr = response.detailTickItems;
////            NSLog(@"%@",Arr);
//            for (int i=0; i<Arr.count; i++) {
//                MTimeTickItem *items = Arr[i];
//                NSLog(@"%@,%@,%@,%lu",items.time8,items.tradePrice,items.tradeVolume,(unsigned long)items.type);
//            }
//
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"分笔对逐笔明细请求错误，错误信息是：%@",resp.message);
//        }
//    }];

////    //练习:逐笔明细表 还原
//    ML2TimeTickDetailRequest *request = [[ML2TimeTickDetailRequest alloc] init];
//    request.code = @"000001.sz";
//    request.subtype = @"1001";
//    request.index = 0;
//    request.pageSize = 20;
//    request.type = MTimeTickRequestTypeRecent;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            ML2TimeTickDetailResponse *response = (ML2TimeTickDetailResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////            NSLog(@"%@,%@",response.startIndex,response.eƒndIndex);
//            NSArray *items = response.items;
////            NSLog(@"%@",response);
//            for (int i=0; i<items.count; i++) {
//                MTimeTickDetailItem *item = items[i];
////                NSLog(@"%@,%@,%@,%lu",item.time8,item.tradePrice,item.tradeVolume,item.type);
////               NSLog(@"交易时间%@,成交价格%@,交易量%@,买卖方向%lu",items.time8,items.tradePrice,items.tradeVolume,(unsigned long)items.type);
//
////                NSLog(@"交易时间:%@,交易价格:%@,成交量:%@,买单量:%@,卖单量:%@,买委托序号:%@,卖委托序号:%@",item.time8,item.tradePrice,item.tradeVolume,item.bq,item.oq,item.bn,item.on);
//                NSLog(@"%@",item);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"逐笔明细表请求错误，错误信息是：%@",resp.message);
//        }
//    }];


//     //Level2Plus 逐笔委托接口
//    ML2TickEntrustRequest *request = [[ML2TickEntrustRequest alloc] init];
//     request.code = @"600000.sh";
//    NSLog(@"&*:%@",request.code);
//     request.subtype = @"1001";
////     request.index = 4573267;
//    request.param = @"0,200,-1";
////     request.pageSize = 104;
////     request.type = MTimeTickRequestTypeRecent;
//     //发送请求
//     [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//         NSLog(@"降低呵护u啊哈啊%@",resp);
//         if (resp.status == MResponseStatusSuccess) {
//             //应答无误，处理数据更新画面
//             ML2TickEntrustResponse *response = (ML2TickEntrustResponse *)resp;
//             NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//             self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////
//             NSArray *items = response.items;
//
//             for (int i=0; i<items.count; i++) {
//                 MTickEntrustItem *item = items[i];
//                 NSLog(@"%@",item);
////                 NSLog(@"%@，%@，%@，%@，%@",item.time,item.sn,item.price,item.volume,item.bs);
//             }
//         } else {
//             //应答错误，显示错误信息
//             NSLog(@"逐笔明细表请求错误，错误信息是：%@",resp.message);
//         }
//     }];
////
////    Level2Plus 逐笔还原接口
//    ML2PlusTimeTickDetailRequest *request = [[ML2PlusTimeTickDetailRequest alloc] init];
//     request.code = @"600000.sh";
//    NSLog(@"&*:%@",request.code);
//     request.subtype = @"1001";
////    request.param = @"0,100";
//     request.index = 0;
//     request.pageSize = 104;
//     request.type = MTimeTickRequestTypeRecent;
//     //发送请求
//     [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//         NSLog(@"降低呵护u啊哈啊%@",resp);
//         if (resp.status == MResponseStatusSuccess) {
//             //应答无误，处理数据更新画面
//             ML2PlusTimeTickDetailResponse *response = (ML2PlusTimeTickDetailResponse *)resp;
//             NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//             self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////
//             NSArray *items = response.items;
//
//             for (int i=0; i<items.count; i++) {
//                 MTimeTickDetailItem *item = items[i];
//                 NSLog(@"%@，%@，%@，%@，%@",item.time,item.bn,item.on,item.bq,item.oq);
//             }
//         } else {
//             //应答错误，显示错误信息
//             NSLog(@"逐笔明细表请求错误，错误信息是：%@",resp.message);
//         }
//     }];


    //练习:个股静态数据
//    MStaticDataRequest *request = [[MStaticDataRequest alloc] init];
//    request.code = @"WY0002.gb";
////    request.param = @"bu,su";
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MStaticDataResponse *response = (MStaticDataResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"个股静态数据请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:两市港股通数据
//    MHKMarketInfoRequest *request = [[MHKMarketInfoRequest alloc] init];
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MHKMarketInfoResponse *response = (MHKMarketInfoResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//           data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"两市港股通数据请求错误，错误信息是：%@",resp.message);
//        }
//    }];
//
//    //练习:次新股
//    MSubnewStockRankingRequest *request = [[MSubnewStockRankingRequest alloc] init];
//    request.pageIndex = 0;
//    request.pageSize = 200;
//    request.ascending =YES;
//    request.field = MSubnewStockRankingFieldContinuousLimitUpDays;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MSubnewStockRankingResponse *response = (MSubnewStockRankingResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            //NSLog(@"1----:%@",response);
//            NSArray *item = response.items;
//            for (int i=0; i<item.count; i++) {
//                MSubnewStockRankingItem *items = item[i];
//                NSLog(@"股票代码%@,连续涨停天数：%ld",items.code,(long)items.continuousLimitUpDays);
////                NSLog(@"次类别：%@,主力资金流入：%@,最新价：%@,总值：%@,总金额：%@,代码：%@,昨收价：%@,动态市盈：%@,换手率：%@,流通股本：%@,流值：%@,发行价：%@,涨跌：%@,每股收益：  %@,总股本：%@,累计涨跌幅：%@,发行时间：%@,涨跌幅：%ld",items.subtype,items.capitalInflow,items.lastPrice,items.totalValue,items.amount,items.code,items.preClosePrice,items.PE,items.turnoverRate,items.circulatingShare,items.flowValue,items.IPOPrice,items.change,items.EPS,items.capitalization,items.totalRate,items.IPODate,(long)items.continuousLimitUpDays);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"次新股请求错误，错误信息是：%@",resp.message);
//        }
//    }];

////    练习:次新债
//    MSubnewBondRankingRequest *request = [[MSubnewBondRankingRequest alloc] init];
//    request.pageIndex = 0;
//    request.pageSize = 200;
//    request.ascending = NO;
//    request.field = MSubnewBondRankingFieldChange;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MSubnewBondRankingResponse *response = (MSubnewBondRankingResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////            NSLog(@"1----:%@",response);
//            NSArray *item = response.items;
//            int i=0;
//            for (i=0; i<item.count; i++) {
//                MSubnewBondRankingItem *items = item[i];
////                NSLog(@"%@,%@",items.code,items.IPODate);
//                NSLog(@"股票代码%@,排序字段:%@",items.code,items.rate);
////    NSLog(@"股票代码%@,主力资金流入%@",items.code,items.capitalInflow);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"次新债请求错误，错误信息是：%@",resp.message);
//        }
//    }];

    //练习:增值指标
//    MAddValueRequest *request = [[MAddValueRequest alloc] init];
//    request.code = @"600000.sh";
//    request.subtype = @"1001";
//    request.fields = @[@"largeBuyDealCount",@"largeSellDealCount",@"buyCount",@"sellCount",@"ultraLargeBuyVolume",@"largeBuyVolume",@"ultraLargeSellVolume",@"largeSellVolume",@"ultraLargeBuyCount",@"largeBuyCount",@"ultraLargeSellCount",@"largeSellCount"];
//
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MAddValueResponse *response = (MAddValueResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//          data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////            NSLog(@"1------:%@",response);
//            NSArray *items = response.addValueItems;
//            NSLog(@"%ld",(long)items.count);
//            for (int i=0;i<items.count;i++){
//                MAddValueItem *item = items[i];
////                NSLog(@"每单大买单成交手数:%@,每单大卖单成交手数:%@,买入单数:%@,卖出单数:%@,超大单主动买入成交量:%@,大单主动买入成交量:%@,超大单主动卖出成交量:%@,大单主动卖出成交量:%@,超大单买入单数:%@,大单买入单数:%@,超大单卖出单数:%@,大单卖出单数:%@",item.largeBuyDealCount,item.largeSellDealCount,item.buyCount,item.sellCount,item.ultraLargeBuyVolume,item.largeBuyVolume,item.ultraLargeSellVolume,item.largeSellVolume,item.ultraLargeBuyCount,item.largeBuyCount,item.ultraLargeSellCount,item.largeSellCount);
//                   NSLog(@"%@",items);
//            }
//
////            NSLog(@"%@,%@,%@,%@,%@,%@",items.code,items.ultraLargeBuyVolume,items.ultraLargeSellVolume,items.largeBuyAmount,items.smallSellAmount,items.ddy);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"增值指标请求错误，错误信息是：%@",resp.message);
//        }
//    }];

//    //练习:市场交易日接口
//    MTradeDateRequest *request = [[MTradeDateRequest alloc] init];
//    request.market = @"SH";//市场，如SH（沪市）,SZ（深市）,BJ（新三板）,HK（港股）,SHHK（沪港通）,SZHK（深港通）,CFF（中金所）,ZCE（郑商所）,DCE（大商所）
////    request.date = @"20200106";//交易日历
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MTradeDateResponse *response = (MTradeDateResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"站点信息：%@",request.ip);
//            NSLog(@"请求数据：%@",request);
////            NSLog(@"1----:%@",response.dates[0]);
//            NSLog(@"%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"市场交易日接口请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
//    //练习：沪股通和深股通合并数据接口
//        MHSAmountAllRequest *request = [[MHSAmountAllRequest alloc] init];


//        发送请求
//     4
    
    
    //练习:沪股通和深股通额度数据接口
//    MHSAmountRequest *request = [[MHSAmountRequest alloc] init];
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MHSAmountResponse *response = (MHSAmountResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"沪股通和深股通额度数据接口请求错误，错误信息是：%@",resp.message);
//        }
//    }];

    //练习：港股价差数据接口
//    MHKPriceDiffRequest *request = [[MHKPriceDiffRequest alloc] init];
//
//
////    发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MHKPriceDiffResponse *response = (MHKPriceDiffResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"港股价差数据请求错误，错误信息是：%@",resp.message);
//        }
//    }];
//
////    练习:交易行情数据接口
//    MTradeQuoteRequest *request = [[MTradeQuoteRequest alloc] init];
//    request.code = @"430047.bz";
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MTradeQuoteResponse *response = (MTradeQuoteResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            MTradeItem *item = response.tradeItem;
////            NSLog(@"站点信息：%@",request.ip);
//////            NSLog(@"价格档位:%@/买数量单位:%@/卖数量单位:%@",item.priceUnit,item.buyVolumeUnit,item.sellVolumeUnit);
////             NSLog(@"%@",item);
////            NSLog(@"一、五、十档委买价, 买10 -> 买1%@,一、五、十档委买量, 买10 -> 买1%@,五、十档委卖价, 卖1 -> 卖10%@,一、五、十档委卖量, 卖1 -> 卖10%@,最新价%@,涨跌比率%@,涨跌%@,涨跌状态%ld,涨停价%@,跌停价%@,买数量单位（手转股单位）%@,卖数量单位（手转股单位）%@,昨收价%@,价格档位%@",item.buyPrices,item.buyVolumes,item.sellPrices,item.sellVolumes,item.lastPrice,item.changeRate,item.change,item.changeState,item.limitUp,item.limitDown,item.buyVolumeUnit,item.sellVolumeUnit,item.preClosePrice,item.priceUnit);
////
//
//            NSLog(@"股票代码：%@",item.code);
//            NSLog(@"子类型：%@",item.subtype);
//            NSLog(@"股票名称：%@",item.name);
//            NSLog(@"一、五、十档委买价,买10->买1：%@",item.buyPrices);
//            NSLog(@"一、五、十档委买量,买10->买1：%@",item.buyVolumes);
//            NSLog(@"一、五、十档委卖价,卖1->卖10：%@",item.sellPrices);
//            NSLog(@"一、五、十档委卖量,卖1->卖10：%@",item.sellVolumes);
//            NSLog(@"最新价：%@",item.lastPrice);
//            NSLog(@"昨收价：%@",item.preClosePrice);
//            NSLog(@"涨停价：%@",item.limitUp);
//            NSLog(@"跌停价：%@",item.limitDown);
//            NSLog(@"涨跌：%@",item.change);
//            NSLog(@"涨跌比率：%@",item.changeRate);
//            NSLog(@"涨跌状态：%lu",(unsigned long)item.changeState);
//            NSLog(@"买数量单位（手转股单位）：%@",item.buyVolumeUnit);
//            NSLog(@"卖数量单位（手转股单位）：%@",item.sellVolumeUnit);
//            NSLog(@"价格档位：%@",item.priceUnit);
//            NSLog(@"价差类别：%@",item.priceDiffType);
//            NSLog(@"限价买数量上限（仅深交所有值）：%@",item.buyQtyUpperLimit);
//            NSLog(@"限价卖数量上限（仅深交所有值）：%@",item.sellQtyUpperLimit);
//            NSLog(@"市价买数量上限（仅深交所有值）：%@",item.marketBuyQtyUpperLimit);
//            NSLog(@"市价卖数量上限（仅深交所有值）：%@",item.marketSellQtyUpperLimit);
//            NSLog(@"买数量上限（盘后定价交易业务参考信息）（仅深交所有值）：%@",item.AFBuyQtyUpperLimit);
//            NSLog(@"卖数量上限（盘后定价交易业务参考信息）（仅深交所有值）：%@",item.AFSellQtyUpperLimit);
//            NSLog(@"市价买数量单位（仅深交所有值）：%@",item.marketBuyQtyUnit);
//            NSLog(@"市价卖数量单位（仅深交所有值）：%@",item.marketSellQtyUnit);
//            NSLog(@"盘后定价交易业务参考信息买数量单位（仅深交所有值）：%@",item.AFBuyQtyUnit);
//            NSLog(@"盘后定价交易业务参考信息卖数量单位（仅深交所有值）：%@",item.AFSellQtyUnit);
//
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"交易行情数据接口请求错误，错误信息是：%@",resp.message);
//        }
//    }];

////


//////    练习:F10通用
//    MF10Request *request = [[MF10Request alloc] init];
//    request.code = @"600000.sh"; //填入股票代码
////    request.param = @{@"param":@"0,10"};
//    request.requestType = MF10RequestTypeCLSTelegrammedList;
//    request.sourceType = MF10DataSourceCLS;
////    request.param = @{@"param":@"0,10"};
////    request.param = @{@"type":@"new",@"param":@"0,500"};//当传入此参数时，数据返回发布公告
////    request.param = @{@"type":@"ADVAPAYM_0"};
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MF10Response *response = (MF10Response *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response.JSONObject];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSDictionary *dica = response.JSONObject;
//            NSLog(@"1--+++++--:%@",dic);
////            NSLog(@"1----:%@",response.JSONObject);
//            NSLog(@"1----:%@",request.requestType);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"財汇沪深盘后接口,重要指标站点请求错误，错误信息是：%@",resp.message);
//        }
//    }];

 
////    练习:最新指标
//    MLatestIndexRequest *request = [[MLatestIndexRequest alloc] init];
//    request.code = @"000002.sz"; //填入股票代码
//    request.sourceType = MF10DataSourceGA;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MLatestIndexResponse *response = (MLatestIndexResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"最新指标请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
//    ////    练习:港股简况分析信息请求类
//    MHKIPOCompinfoRequest *request = [[MHKIPOCompinfoRequest alloc] init];
//        request.code = @"02265.hk"; //填入股票代码
//        request.sourceType = MF10DataSourceCH;
//
//        //发送请求
//        [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//            if (resp.status == MResponseStatusSuccess) {
//                //应答无误，处理数据更新画面
//                MHKIPOCompinfoResponse *response = (MHKIPOCompinfoResponse *)resp;
//                NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//                NSLog(@"1----:%@",response);
//            } else {
//                //应答错误，显示错误信息
//                NSLog(@"港股简况分析信息请求错误，错误信息是：%@",resp.message);
//            }
//        }];
    ////    练习:港股发行资料信息请求类
//    MHKIPOIssueinfoRequest *request = [[MHKIPOIssueinfoRequest alloc] init];
//        request.code = @"02265.hk"; //填入股票代码
//        request.sourceType = MF10DataSourceCH;
//
//        //发送请求
//        [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//            if (resp.status == MResponseStatusSuccess) {
//                //应答无误，处理数据更新画面
//                MHKIPOIssueinfoResponse *response = (MHKIPOIssueinfoResponse *)resp;
//                NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//                NSLog(@"1----:%@",response);
//            } else {
//                //应答错误，显示错误信息
//                NSLog(@"港股发行资料信请求错误，错误信息是：%@",resp.message);
//            }
//        }];
    
    //    练习:港股配售结果信息请求类
//    MHKIPOIssueresultRequest *request = [[MHKIPOIssueresultRequest alloc] init];
//        request.code = @"02265.hk"; //填入股票代码
//        request.sourceType = MF10DataSourceCH;
//
//        //发送请求
//        [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//            if (resp.status == MResponseStatusSuccess) {
//                //应答无误，处理数据更新画面
//                MHKIPOIssueresultResponse *response = (MHKIPOIssueresultResponse *)resp;
//                NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//                data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//                NSLog(@"1----:%@",response);
//            } else {
//                //应答错误，显示错误信息
//                NSLog(@"港股配售结果信息请求错误，错误信息是：%@",resp.message);
//            }
//        }];
////
//    //练习:大事提醒
//    MBigEventNotificationRequest *request = [[MBigEventNotificationRequest alloc] init];
//    request.code = @"600000.sh"; //填入股票代码
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MBigEventNotificationResponse *response = (MBigEventNotificationResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"大事提醒请求错误，错误信息是：%@",resp.message);
//        }
//    }];

////    练习:分红配送
//    MBonusFinanceRequest *request = [[MBonusFinanceRequest alloc] init];
//    request.code = @"302002.sz"; //填入股票代码
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MBonusFinanceResponse *response = (MBonusFinanceResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"分红配送请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:融资融券
//    MTradeDetailInfoRequest *request = [[MTradeDetailInfoRequest alloc] init];
//    request.code = @"600000.sh"; //填入股票代码
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MTradeDetailInfoResponse *response = (MTradeDetailInfoResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"融资融券请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:机构预测
//    MForecastYearRequest *request = [[MForecastYearRequest alloc] init];
//    request.code = @"600000.sh"; //填入股票代码
//    request.sourceType = MF10DataSourceGA;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MForecastYearResponse *response = (MForecastYearResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"机构预测请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:机构评等
//    MForecastRatingRequest *request = [[MForecastRatingRequest alloc] init];
//    request.code = @"600000.sh"; //填入股票代码
//    request.sourceType = MF10DataSourceGA;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MForecastRatingResponse *response = (MForecastRatingResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"机构评等请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:基本情况
//    MCompanyInfoRequest *request = [[MCompanyInfoRequest alloc] init];
//    request.code = @"600000.sh"; //填入股票代码
////    request.sourceType = MF10DataSourceGA;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MCompanyInfoResponse *response = (MCompanyInfoResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"基本情况请求错误，错误信息是：%@",resp.message);
//        }
//    }];
//
    //练习:主要业务
//    MCoreBusinessRequest *request = [[MCoreBusinessRequest alloc] init];
//    request.code = @"600000.sh"; //填入股票代码
//    request.sourceType = MF10DataSourceGA;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MCoreBusinessResponse *response = (MCoreBusinessResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"主要业务请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:管理层
//    MLeaderPersonInfoRequest *request = [[MLeaderPersonInfoRequest alloc] init];
//    request.code = @"600075.sh"; //填入股票代码
//    request.sourceType = MF10DataSourceGA;
//
//        //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MLeaderPersonInfoResponse *response = (MLeaderPersonInfoResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"管理层请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
//    //练习:财务指标
//    MFinancialSummaryRequest *request = [[MFinancialSummaryRequest alloc] init];
//    request.code = @"00700.hk"; //填入股票代码
//    request.sourceType = MF10DataSourceCH;
//    request.param = nil;
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MFinancialSummaryResponse *response = (MFinancialSummaryResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"财务指标请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
//    练习:财务报表
//    MFinancialInfoRequest *request = [[MFinancialInfoRequest alloc] init];
//    request.code = @"00700.hk"; //填入股票代码
//    request.sourceType = MF10DataSourceCH;
//    request.param = @{@"type":@"N"};
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MFinancialInfoResponse *response = (MFinancialInfoResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"财务报表请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:股本结构
//    MStockShareInfoRequest *request = [[MStockShareInfoRequest alloc] init];
//    request.code = @"832003.bj"; //填入股票代码
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MStockShareInfoResponse *response = (MStockShareInfoResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"股本结构请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:股本变动
//    MStockShareChangeInfoRequest *request = [[MStockShareChangeInfoRequest alloc] init];
//    request.code = @"832003.bj"; //填入股票代码
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MStockShareChangeInfoResponse *response = (MStockShareChangeInfoResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"股本变动请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:股东变动
//    MShareHolderHistoryInfoRequest *request = [[MShareHolderHistoryInfoRequest alloc] init];
//    request.code = @"000031.sz"; //填入股票代码
//    request.sourceType = MF10DataSourceGA;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MShareHolderHistoryInfoResponse *response = (MShareHolderHistoryInfoResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"股东变动请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
//    //练习:最新自然人持股
//    MTopLiquidShareHolderRequest *request = [[MTopLiquidShareHolderRequest alloc] init];
//    request.code = @"603876.sh"; //填入股票代码
//    request.sourceType = MF10DataSourceGA;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MTopLiquidShareHolderResponse *response = (MTopLiquidShareHolderResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"最新十大流通股股东请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:最新机构持股
//    MTopShareHolderRequest *request = [[MTopShareHolderRequest alloc] init];
//    request.code = @"002929.sz"; //填入股票代码
//    request.sourceType = MF10DataSourceGA;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MTopShareHolderResponse *response = (MTopShareHolderResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"十大机构股东请求错误，错误信息是：%@",resp.message);
//        }
//    }];
//
    //练习:最新基金持股
//    MFundShareHolderInfoRequest *request = [[MFundShareHolderInfoRequest alloc] init];
//    request.code = @"600000.sh"; //填入股票代码
//    request.sourceType = MF10DataSourceGA;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MFundShareHolderInfoResponse *response = (MFundShareHolderInfoResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"最新基金持股请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
////    练习:财经资讯列表
//    MNewsListRequest *request = [[MNewsListRequest alloc] init];
//    request.newsType = MNewsTypeIndustry;
//    //request.pageIndex = 0;
//    request.sourceType = MF10DataSourceGA;
//    request.newsID = @"nil";
//    request.type = F10NewsRequestTypeRecent;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MNewsListResponse *response = (MNewsListResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",request.ip);
//            NSLog(@"1----:%@",request);
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"财经资讯列表请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
//    练习:财经资讯明细
//    MNewsRequest *request = [[MNewsRequest alloc] init];
//    request.newsID = @"87054397612"; //填入新闻序号
//    request.sourceType = MF10DataSourceGA;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MNewsResponse *response = (MNewsResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"财经资讯明细请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
//    //练习:个股公告列表
//    MStockBulletinListRequest *request = [[MStockBulletinListRequest alloc] init];
//    request.code = @"600035.sh"; //填入股票代码
////    request.pageIndex = 0;
//    request.pageSize = 100;
//    request.sourceType = MF10DataSourceCH;
////    request.newsID = @"200056.sz_4964741";
//    request.type = F10NewsRequestTypeRecent;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MStockBulletinListResponse *response = (MStockBulletinListResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            //NSLog(@"1----:%@",response);
//            NSArray *item = response.stockBulletinItems;
//            for (int i=0; i<item.count; i++) {
//                MStockNewsItem *items = item[i];
//                NSLog(@"%@,%@,%@,%@,%ld,%@,%@,%@",items.ID,items.datetime,items.entryDate,items.entryTime,items.isPDF,items.source,items.stockName,items.title);
//            }
//
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"个股公告列表请求错误，错误信息是：%@",resp.message);
//        }
//    }];
   
    //练习:个股公告明细
//    MStockBulletinRequest *request = [[MStockBulletinRequest alloc] init];
//    request.stockBulletinID = @"200045.sz_5117660"; //填入公告序号
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MStockBulletinResponse *response = (MStockBulletinResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"个股公告明细请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
////    练习:个股新闻列表
//    MStockNewsListRequest *request = [[MStockNewsListRequest alloc] init];
//    request.code = @"600600.sh"; //填入股票代码
////    request.pageIndex = 2;
//    request.pageSize = 50;
//    request.sourceType = MF10DataSourceCH;
////    request.newsID = @"600600.sh_20190415020008235096";
//    request.type = F10NewsRequestTypeRecent;

//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MStockNewsListResponse *response = (MStockNewsListResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSArray *item = response.stockNewsItems;
//            for (int i=0; i<item.count; i++) {
//                MStockNewsItem *items = item[i];
//                NSLog(@"%@,%@,%@",items.ID,items.datetime,items.title);
//                //NSLog(@"%@",items);
//            }
//
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"个股新闻列表请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:个股新闻明细
//    MStockNewsRequest *request = [[MStockNewsRequest alloc] init];
//    request.stockNewsID = @"600600.sh_20191224020010280269"; //填入公告序号
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MStockNewsResponse *response = (MStockNewsResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"个股新闻明细请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
//    //练习:个股研报列表
//    MStockReportListRequest *request = [[MStockReportListRequest alloc] init];
//    request.code = @"600000.sh"; //填入股票代码
////    request.pageIndex = 0;
//    request.pageSize = 20;
//    request.sourceType = MF10DataSourceCH;
//    //request.newsID = @"000001.sz_4308797 ";
//    request.type = F10NewsRequestTypeRecent;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MStockReportListResponse *response = (MStockReportListResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//            NSArray *item = response.stockReportItems;
//            for (int i=0; i<item.count; i++) {
//                MStockNewsItem *items = item[i];
//                NSLog(@"%@,%@,%@",items.ID,items.datetime,items.title);
//                //NSLog(@"%@",items);
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"个股研报列表请求错误，错误信息是：%@",resp.message);
//        }
//    }];
////
    //练习:个股研报明细
//    MStockReportRequest *request = [[MStockReportRequest alloc] init];
//    request.stockReportID = @"600519.sh_4631669"; //填入公告序号
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MStockReportResponse *response = (MStockReportResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//            NSArray *item = response.stockReportDetailItem;
//            for (int i=0; i<item.count; i++) {
//            MStockNewsItem *items = item[i];
//            NSLog(@"%@,%@,%@",items.ID,items.datetime,items.title);
//                //NSLog(@"%@",items)
//
//            }
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"个股研报明细请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
////    练习:新股(债)上市日期信息
//    MIPODateRequest *request = [[MIPODateRequest alloc] init];
//    request.sourceType = MF10DataSourceCH;
//    request.type = MIPOTypeBond;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MIPODateResponse *response = (MIPODateResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//           data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1=====:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"新股上市日期信息请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
////    练习:新股(债)列表
//    MIPOCalendarRequest *request = [[MIPOCalendarRequest alloc] init];
//    request.date = @"2021-11-03";
//    request.sourceType = MF10DataSourceCH;
//    request.type = MIPOTypeBond;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MIPOCalendarResponse *response = (MIPOCalendarResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
////            NSLog(@"1----:%@",response.info);
//            NSDictionary *item = response.info;
//            NSLog(@"1----:%@",item);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"新股列表请求错误，错误信息是：%@",resp.message);
//        }
//    }];
////
////    练习:新股(债)详情
//    MIPOShareDetailRequest *request = [[MIPOShareDetailRequest alloc] init];
//    request.code = @"302002.sz";
//    request.sourceType = MF10DataSourceCH;
////    request.type = MIPOTypeBond;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MIPOShareDetailResponse *response = (MIPOShareDetailResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"新股详情请求错误，错误信息是：%@",resp.message);
//        }
//    }];
//
//    //练习:基金净值
//    MFundValueRequest *request = [[MFundValueRequest alloc] init];
//    request.code = @"502058.sh";
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MFundValueResponse *response = (MFundValueResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"基金净值请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:基金概况
//    MFundBasicInfoRequest *request = [[MFundBasicInfoRequest alloc] init];
//    request.code = @"502024.sh";
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MFundBasicInfoResponse *response = (MFundBasicInfoResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"基金概况请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:基金净值(5天)
//    MFundNetValueRequest *request = [[MFundNetValueRequest alloc] init];
//    request.code = @"510050.sh";
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MFundNetValueResponse *response = (MFundNetValueResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"基金净值请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:资产配置
//    MFundAssetAllocationRequest *request = [[MFundAssetAllocationRequest alloc] init];
//    request.code = @"500058.sh";
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MFundAssetAllocationResponse *response = (MFundAssetAllocationResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1=====:%@",response.records);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"资产配置请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:行业组合
//    MFundIndustryPortfolioRequest *request = [[MFundIndustryPortfolioRequest alloc] init];
//    request.code = @"833382.bj";
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MFundIndustryPortfolioResponse *response = (MFundIndustryPortfolioResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1=====:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"行业组合请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:股票组合
//    MFundStockPortfolioRequest *request = [[MFundStockPortfolioRequest alloc] init];
//    request.code = @"833382.bj";
//    request.sourceType = MF10DataSourceGA;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MFundStockPortfolioResponse *response = (MFundStockPortfolioResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1=====:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"股票组合请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:份额结构
//    MFundShareStructRequest *request = [[MFundShareStructRequest alloc] init];
//    request.code = @"833382.bj";
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MFundShareStructResponse *response = (MFundShareStructResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1=====:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"份额结构请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:基金财务
//    MFundFinanceRequest *request = [[MFundFinanceRequest alloc] init];
//    request.code = @"833382.bj";
//    request.sourceType = MF10DataSourceGA;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MFundFinanceResponse *response = (MFundFinanceResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1=====:%@",response);
//
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"基金财务请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:基金分红
//    MFundDividendRequest *request = [[MFundDividendRequest alloc] init];
//    request.code = @"502049.sh";
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MFundDividendResponse *response = (MFundDividendResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1=====:%@",response);
//
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"基金分红请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:债券概况
//    MBondBasicInfoRequest *request = [[MBondBasicInfoRequest alloc] init];
//    request.code = @"113009.sh";
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MBondBasicInfoResponse *response = (MBondBasicInfoResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1=====:%@",response);f fe
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"债券概况请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:付息情况
//    MBondInterestPayRequest *request = [[MBondInterestPayRequest alloc] init];
//    request.code = @"113503.sh";
//    request.sourceType = MF10DataSourceGA;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MBondInterestPayResponse *response = (MBondInterestPayResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1=====:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"付息情况请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:债券回购
//    MBondBuyBacksRequest *request = [[MBondBuyBacksRequest alloc] init];
//    request.code = @"128009.sz";
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        NSLog(@"%ld", (long)resp.status);
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MBondBuyBacksResponse *response = (MBondBuyBacksResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"债券回购请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:分级基金
//    MGradeFundRequest *request = [[MGradeFundRequest alloc] init];
//    request.code = @"502004.sh";
//    request.gradeFundType = MGradeFundTypeInfo;
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MGradeFundResponse *response = (MGradeFundResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"分级基金请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
//    练习:融资融券--分市场提供最近交易日融资融券数据
//    MMarginInfoRequest *request = [[MMarginInfoRequest alloc] init];
//    request.market = @"sh_sz";//市场
//    request.field = @"FINBALANCE";
//    request.pageIndex = 1;
//    request.pageSize = 10;
//    request.ascending = NO;
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MMarginInfoResponse *response = (MMarginInfoResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"融资融券--分市场请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
    //练习:融资融券--融资融券差额接口(最近90天)
//    MMarginInfoDiffRequest *request = [[MMarginInfoDiffRequest alloc] init];
//    request.market = @"sh_sz";
//    request.pageIndex = 0;
//    request.pageSize = 20;
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MMarginInfoDiffResponse *response = (MMarginInfoDiffResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"融资融券--融资融券差额请求错误，错误信息是：%@",resp.message);
//        }
//    }];

//    练习:融资融券--个股融资融券接口（最近90天）
//    MMarginInfoShareRequest *request = [[MMarginInfoShareRequest alloc] init];
//    request.code = @"600000.sh";
//    request.pageIndex = 0;
//    request.pageSize = 90;
//    request.sourceType = MF10DataSourceCH;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MMarginInfoShareResponse *response = (MMarginInfoShareResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            self.data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"融资融券--个股融资融券请求错误，错误信息是：%@",resp.message);
//        }
//    }];
    
////  练习: 港股通额度和沪深股通额度走势
//    MTongLineRequest *request = [[MTongLineRequest alloc] init];
//    request.type = @"hkt";
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MTongLineResponse *response = (MTongLineResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"融资融券--个股融资融券请求错误，错误信息是：%@",resp.message);
//        }
//    }];

//    练习: 涨停商品行情请求类
//    MZTSortingRequest *request = [[MZTSortingRequest alloc] init];
//    request.pageIndex = 0;
//    request.pageSize = 2000;
//    request.field = MZTSortingFieldZTDatatime;
//    request.ascending = 1;
//    request.type = MZTSortingTypeALL;
//
//    //发送请求
//    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
//        if (resp.status == MResponseStatusSuccess) {
//            //应答无误，处理数据更新画面
//            MZTSortingResponse *response = (MZTSortingResponse *)resp;
//            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
//          data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
//            NSLog(@"1----:%@",response);
//            NSArray *items = response.items;
//           //            NSLog(@"%@",response);
//                       for (int i=0; i<items.count; i++) {
//                           MZTSortingItem *item = items[i];
//                           NSLog(@"changeRate%@,%@,%@,lastPrice%@,preClosePrice%@",item.changeRate,item.code,item.dateTime,item.lastPrice,item.preClosePrice);
//
//                       }
//
//        } else {
//            //应答错误，显示错误信息
//            NSLog(@"融资融券--个股融资融券请求错误，错误信息是：%@",resp.message);
//        }
//    }];

        
}

-(void)triggerStorage
{
    if (data == nil) {
        NSLog(@"暂时未受到数据，稍后重试");
    } else {
        NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
        NSString *path=[paths    objectAtIndex:0];
        NSString *filename=[path stringByAppendingPathComponent:@"test.plist"];   //获取路径
        NSLog(@"%@",path);
        NSFileManager* fm = [NSFileManager defaultManager];
        [fm createFileAtPath:filename contents:nil attributes:nil];
        //NSDictionary* dic = [NSDictionary dictionaryWithContentsOfFile:plistPath];
        //写入数据
        NSDictionary * dict1=data;
        BOOL isSuccess = [dict1 writeToFile:filename atomically:YES];
        if (isSuccess) {
            NSLog(@"成功啦！");
        } else {
            NSLog(@"失败啦！");
        }
    }


}

-(void)ceshi
{
    MChartIndexRequest *request = [[MChartIndexRequest alloc] init];
    request.code = @"688009.sh"; //填入股票代码
    request.type = MChartIndexTypeDefault;
    request.beginIndex = 0;
    request.endIndex = 50;

    //发送请求
    [MApi sendRequest:request completionHandler:^(MResponse *resp) {
        if (resp.status == MResponseStatusSuccess) {
            //应答无误，处理数据更新画面
            MChartIndexResponse *response = (MChartIndexResponse *)resp;
            NSDictionary * dic=[self getDictionaryFromObject_Ext:response];
            data=[NSDictionary dictionaryWithObjectsAndKeys:dic,NSStringFromClass([response class]), nil];
            NSLog(@"站点信息:%@",request.ip);
            NSArray *item = response.OHLCItems;
            NSLog(@"%ld",item.count);
            for (int i=0; i<item.count; i++) {
            MOHLCItem *items = item[i];
            NSLog(@"%@",items);
            }
        } else {
            //应答错误，显示错误信息
            NSLog(@"分时走势指标数据请求错误，错误信息是：%@",resp.message);
        }
    }];
}


@end



